From 6b3f572338a59a9c233c7cf29fd22e2de0020308 Mon Sep 17 00:00:00 2001 From: Quynh Tran Date: Mon, 20 Nov 2023 21:38:57 +1100 Subject: [PATCH 01/47] feat: add PG OID support --- .../clirr-ignored-differences.xml | 57 +++ .../cloud/spanner/AbstractResultSet.java | 68 ++++ .../cloud/spanner/AbstractStructReader.java | 45 +++ .../cloud/spanner/ForwardingStructReader.java | 35 ++ .../com/google/cloud/spanner/ResultSets.java | 30 ++ .../java/com/google/cloud/spanner/Struct.java | 19 + .../google/cloud/spanner/StructReader.java | 56 +++ .../java/com/google/cloud/spanner/Type.java | 12 + .../java/com/google/cloud/spanner/Value.java | 173 +++++++++ .../com/google/cloud/spanner/ValueBinder.java | 15 + .../spanner/connection/ChecksumResultSet.java | 12 + .../connection/DirectExecuteResultSet.java | 36 ++ .../ReplaceableForwardingResultSet.java | 36 ++ .../AbstractStructReaderTypesTest.java | 23 ++ .../cloud/spanner/DatabaseClientImplTest.java | 362 ++++++++++-------- .../cloud/spanner/GrpcResultSetTest.java | 31 ++ .../google/cloud/spanner/MutationTest.java | 10 + .../google/cloud/spanner/ResultSetsTest.java | 25 +- .../com/google/cloud/spanner/TypeTest.java | 10 + .../google/cloud/spanner/ValueBinderTest.java | 10 + .../com/google/cloud/spanner/ValueTest.java | 106 +++++ .../connection/ChecksumResultSetTest.java | 16 +- .../DirectExecuteResultSetTest.java | 13 + .../connection/RandomResultSetGenerator.java | 152 ++++---- .../google/cloud/spanner/it/ITQueryTest.java | 13 + 25 files changed, 1130 insertions(+), 235 deletions(-) diff --git a/google-cloud-spanner/clirr-ignored-differences.xml b/google-cloud-spanner/clirr-ignored-differences.xml index 42039d2d2b9..d19ec14b293 100644 --- a/google-cloud-spanner/clirr-ignored-differences.xml +++ b/google-cloud-spanner/clirr-ignored-differences.xml @@ -192,6 +192,63 @@ com/google/cloud/spanner/StructReader java.util.List getPgJsonbList(java.lang.String) + + + 7013 + com/google/cloud/spanner/AbstractStructReader + long[] getPgOidArrayInternal(int) + + + 7013 + com/google/cloud/spanner/AbstractStructReader + long getPgOidInternal(int) + + + 7013 + com/google/cloud/spanner/AbstractStructReader + java.util.List getPgOidListInternal(int) + + + 7012 + com/google/cloud/spanner/StructReader + long getPgOid(int) + + + 7012 + com/google/cloud/spanner/StructReader + long getPgOid(java.lang.String) + + + 7012 + com/google/cloud/spanner/StructReader + long[] getPgOidArray(int) + + + 7012 + com/google/cloud/spanner/StructReader + long[] getPgOidArray(java.lang.String) + + + 7012 + com/google/cloud/spanner/StructReader + java.util.List getPgOidList(int) + + + 7012 + com/google/cloud/spanner/StructReader + java.util.List getPgOidList(java.lang.String) + + + 7013 + com/google/cloud/spanner/Value + long getPgOid() + + + 7013 + com/google/cloud/spanner/Value + java.util.List getPgOidArray() + + 7012 com/google/cloud/spanner/BatchClient diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java index b0d5ab2bbaf..a90e0763efe 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java @@ -480,6 +480,9 @@ private Object writeReplace() { case PG_JSONB: builder.set(fieldName).to(Value.pgJsonb((String) value)); break; + case PG_OID: + builder.set(fieldName).to(Value.pgOid((Long) value)); + break; case BYTES: builder .set(fieldName) @@ -520,6 +523,9 @@ private Object writeReplace() { case PG_JSONB: builder.set(fieldName).toPgJsonbArray((Iterable) value); break; + case PG_OID: + builder.set(fieldName).toPgOidArray((Iterable) value); + break; case BYTES: builder .set(fieldName) @@ -596,6 +602,7 @@ private static Object decodeValue(Type fieldType, com.google.protobuf.Value prot checkType(fieldType, proto, KindCase.BOOL_VALUE); return proto.getBoolValue(); case INT64: + case PG_OID: checkType(fieldType, proto, KindCase.STRING_VALUE); return Long.parseLong(proto.getStringValue()); case FLOAT64: @@ -666,6 +673,8 @@ static Object decodeArrayValue(Type elementType, ListValue listValue) { case STRUCT: return Lists.transform( listValue.getValuesList(), input -> decodeValue(elementType, input)); + case PG_OID: + return new PgOidArray(listValue); default: throw new AssertionError("Unhandled type code: " + elementType.getCode()); } @@ -734,6 +743,11 @@ protected String getPgJsonbInternal(int columnIndex) { return (String) rowData.get(columnIndex); } + @Override + protected long getPgOidInternal(int columnIndex) { + return (Long) rowData.get(columnIndex); + } + @Override protected ByteArray getBytesInternal(int columnIndex) { return getLazyBytesInternal(columnIndex).getByteArray(); @@ -780,6 +794,8 @@ protected Value getValueInternal(int columnIndex) { return Value.json(isNull ? null : getJsonInternal(columnIndex)); case PG_JSONB: return Value.pgJsonb(isNull ? null : getPgJsonbInternal(columnIndex)); + case PG_OID: + return Value.pgOid(isNull ? null : getPgOidInternal(columnIndex)); case BYTES: return Value.internalBytes(isNull ? null : getLazyBytesInternal(columnIndex)); case TIMESTAMP: @@ -810,6 +826,8 @@ protected Value getValueInternal(int columnIndex) { return Value.jsonArray(isNull ? null : getJsonListInternal(columnIndex)); case PG_JSONB: return Value.pgJsonbArray(isNull ? null : getPgJsonbListInternal(columnIndex)); + case PG_OID: + return Value.pgOidArray(isNull ? null : getPgOidListInternal(columnIndex)); case BYTES: return Value.bytesArray(isNull ? null : getBytesListInternal(columnIndex)); case TIMESTAMP: @@ -897,6 +915,16 @@ protected List getPgJsonbListInternal(int columnIndex) { return Collections.unmodifiableList((List) rowData.get(columnIndex)); } + @Override + protected long[] getPgOidArrayInternal(int columnIndex) { + return getPgOidListInternal(columnIndex).toPrimitiveArray(columnIndex); + } + + @Override + protected PgOidArray getPgOidListInternal(int columnIndex) { + return (PgOidArray) rowData.get(columnIndex); + } + @Override @SuppressWarnings("unchecked") // We know ARRAY produces a List. protected List getBytesListInternal(int columnIndex) { @@ -1457,6 +1485,31 @@ Double get(double[] array, int i) { } } + static class PgOidArray extends PrimitiveArray { + PgOidArray(ListValue protoList) { + super(protoList); + } + + PgOidArray(long[] data, BitSet nulls) { + super(data, nulls, data.length); + } + + @Override + long[] newArray(int size) { + return new long[size]; + } + + @Override + void setProto(long[] array, int i, com.google.protobuf.Value protoValue) { + array[i] = Long.parseLong(protoValue.getStringValue()); + } + + @Override + Long get(long[] array, int i) { + return array[i]; + } + } + protected abstract GrpcStruct currRow(); @Override @@ -1499,6 +1552,11 @@ protected String getPgJsonbInternal(int columnIndex) { return currRow().getPgJsonbInternal(columnIndex); } + @Override + protected long getPgOidInternal(int columnIndex) { + return currRow().getPgOidInternal(columnIndex); + } + @Override protected ByteArray getBytesInternal(int columnIndex) { return currRow().getBytesInternal(columnIndex); @@ -1569,6 +1627,16 @@ protected List getPgJsonbListInternal(int columnIndex) { return currRow().getJsonListInternal(columnIndex); } + @Override + protected long[] getPgOidArrayInternal(int columnIndex) { + return currRow().getPgOidArrayInternal(columnIndex); + } + + @Override + protected List getPgOidListInternal(int columnIndex) { + return currRow().getPgOidListInternal(columnIndex); + } + @Override protected List getBytesListInternal(int columnIndex) { return currRow().getBytesListInternal(columnIndex); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java index c868678f109..ac2865c74df 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java @@ -52,6 +52,8 @@ protected String getPgJsonbInternal(int columnIndex) { throw new UnsupportedOperationException("Not implemented"); } + protected abstract long getPgOidInternal(int columnIndex); + protected abstract ByteArray getBytesInternal(int columnIndex); protected abstract Timestamp getTimestampInternal(int columnIndex); @@ -86,6 +88,10 @@ protected List getPgJsonbListInternal(int columnIndex) { throw new UnsupportedOperationException("Not implemented"); } + protected abstract long[] getPgOidArrayInternal(int columnIndex); + + protected abstract List getPgOidListInternal(int columnIndex); + protected abstract List getBytesListInternal(int columnIndex); protected abstract List getTimestampListInternal(int columnIndex); @@ -210,6 +216,19 @@ public String getPgJsonb(String columnName) { return getPgJsonbInternal(columnIndex); } + @Override + public long getPgOid(int columnIndex) { + checkNonNullOfType(columnIndex, Type.pgOid(), columnIndex); + return getPgOidInternal(columnIndex); + } + + @Override + public long getPgOid(String columnName) { + int columnIndex = getColumnIndex(columnName); + checkNonNullOfType(columnIndex, Type.pgOid(), columnName); + return getPgOidInternal(columnIndex); + } + @Override public ByteArray getBytes(int columnIndex) { checkNonNullOfType(columnIndex, Type.bytes(), columnIndex); @@ -398,6 +417,32 @@ public List getPgJsonbList(String columnName) { return getPgJsonbListInternal(columnIndex); } + @Override + public long[] getPgOidArray(int columnIndex) { + checkNonNullOfType(columnIndex, Type.array(Type.pgOid()), columnIndex); + return getPgOidArrayInternal(columnIndex); + } + + @Override + public long[] getPgOidArray(String columnName) { + int columnIndex = getColumnIndex(columnName); + checkNonNullOfType(columnIndex, Type.array(Type.pgOid()), columnName); + return getPgOidArrayInternal(columnIndex); + } + + @Override + public List getPgOidList(int columnIndex) { + checkNonNullOfType(columnIndex, Type.array(Type.pgOid()), columnIndex); + return getPgOidListInternal(columnIndex); + } + + @Override + public List getPgOidList(String columnName) { + int columnIndex = getColumnIndex(columnName); + checkNonNullOfType(columnIndex, Type.array(Type.pgOid()), columnName); + return getPgOidListInternal(columnIndex); + } + @Override public List getBytesList(int columnIndex) { checkNonNullOfType(columnIndex, Type.array(Type.bytes()), columnIndex); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ForwardingStructReader.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ForwardingStructReader.java index 2a85006fa95..8ba1432e161 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ForwardingStructReader.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ForwardingStructReader.java @@ -180,6 +180,18 @@ public String getPgJsonb(String columnName) { return delegate.get().getPgJsonb(columnName); } + @Override + public long getPgOid(int columnIndex) { + checkValidState(); + return delegate.get().getPgOid(columnIndex); + } + + @Override + public long getPgOid(String columnName) { + checkValidState(); + return delegate.get().getPgOid(columnName); + } + @Override public ByteArray getBytes(int columnIndex) { checkValidState(); @@ -334,6 +346,29 @@ public List getPgJsonbList(String columnName) { return delegate.get().getPgJsonbList(columnName); } + public long[] getPgOidArray(int columnIndex) { + checkValidState(); + return delegate.get().getPgOidArray(columnIndex); + } + + @Override + public long[] getPgOidArray(String columnName) { + checkValidState(); + return delegate.get().getPgOidArray(columnName); + } + + @Override + public List getPgOidList(int columnIndex) { + checkValidState(); + return delegate.get().getPgOidList(columnIndex); + } + + @Override + public List getPgOidList(String columnName) { + checkValidState(); + return delegate.get().getPgOidList(columnName); + } + @Override public List getBytesList(int columnIndex) { checkValidState(); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ResultSets.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ResultSets.java index fa054ba0cda..4298826c975 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ResultSets.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ResultSets.java @@ -270,6 +270,16 @@ public String getPgJsonb(String columnName) { return getCurrentRowAsStruct().getPgJsonb(columnName); } + @Override + public long getPgOid(int columnIndex) { + return getCurrentRowAsStruct().getPgOid(columnIndex); + } + + @Override + public long getPgOid(String columnName) { + return getCurrentRowAsStruct().getPgOid(columnName); + } + @Override public ByteArray getBytes(int columnIndex) { return getCurrentRowAsStruct().getBytes(columnIndex); @@ -410,6 +420,26 @@ public List getPgJsonbList(String columnName) { return getCurrentRowAsStruct().getPgJsonbList(columnName); } + @Override + public long[] getPgOidArray(int columnIndex) { + return getCurrentRowAsStruct().getPgOidArray(columnIndex); + } + + @Override + public long[] getPgOidArray(String columnName) { + return getCurrentRowAsStruct().getPgOidArray(columnName); + } + + @Override + public List getPgOidList(int columnIndex) { + return getCurrentRowAsStruct().getPgOidList(columnIndex); + } + + @Override + public List getPgOidList(String columnName) { + return getCurrentRowAsStruct().getPgOidList(columnName); + } + @Override public List getBytesList(int columnIndex) { return getCurrentRowAsStruct().getBytesList(columnIndex); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Struct.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Struct.java index 48c989d145e..2a2a6d069a4 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Struct.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Struct.java @@ -202,6 +202,11 @@ protected String getPgJsonbInternal(int columnIndex) { return values.get(columnIndex).getPgJsonb(); } + @Override + protected long getPgOidInternal(int columnIndex) { + return values.get(columnIndex).getPgOid(); + } + @Override protected ByteArray getBytesInternal(int columnIndex) { return values.get(columnIndex).getBytes(); @@ -277,6 +282,16 @@ protected List getPgJsonbListInternal(int columnIndex) { return values.get(columnIndex).getPgJsonbArray(); } + @Override + protected long[] getPgOidArrayInternal(int columnIndex) { + return Longs.toArray(getPgOidListInternal(columnIndex)); + } + + @Override + protected List getPgOidListInternal(int columnIndex) { + return values.get(columnIndex).getPgOidArray(); + } + @Override protected List getBytesListInternal(int columnIndex) { return values.get(columnIndex).getBytesArray(); @@ -367,6 +382,8 @@ private Object getAsObject(int columnIndex) { return getJsonInternal(columnIndex); case PG_JSONB: return getPgJsonbInternal(columnIndex); + case PG_OID: + return getPgOidInternal(columnIndex); case BYTES: return getBytesInternal(columnIndex); case TIMESTAMP: @@ -393,6 +410,8 @@ private Object getAsObject(int columnIndex) { return getJsonListInternal(columnIndex); case PG_JSONB: return getPgJsonbListInternal(columnIndex); + case PG_OID: + return getPgOidListInternal(columnIndex); case BYTES: return getBytesListInternal(columnIndex); case TIMESTAMP: diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/StructReader.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/StructReader.java index ad085ca2dcc..fceb91e779b 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/StructReader.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/StructReader.java @@ -188,6 +188,22 @@ default String getPgJsonb(String columnName) { throw new UnsupportedOperationException("method should be overwritten"); } + /** + * @param columnIndex index of the column + * @return the value of a non-{@code NULL} column with type {@link Type#pgOid()}. + */ + default long getPgOid(int columnIndex) { + throw new UnsupportedOperationException("method should be overwritten"); + } + + /** + * @param columnName name of the column + * @return the value of a non-{@code NULL} column with type {@link Type#pgOid()}. + */ + default long getPgOid(String columnName) { + throw new UnsupportedOperationException("method should be overwritten"); + } + /** * @param columnIndex index of the column * @return the value of a non-{@code NULL} column with type {@link Type#bytes()}. @@ -408,6 +424,46 @@ default List getPgJsonbList(String columnName) { throw new UnsupportedOperationException("method should be overwritten"); }; + /** + * @param columnIndex index of the column + * @return the value of a non-{@code NULL} column with type {@code Type.array(Type.pgOid())}. + * @throws NullPointerException if any element of the array value is {@code NULL}. If the array + * may contain {@code NULL} values, use {@link #getPgOidList(int)} instead. + */ + default long[] getPgOidArray(int columnIndex) { + throw new UnsupportedOperationException("method should be overwritten"); + }; + + /** + * @param columnName name of the column + * @return the value of a non-{@code NULL} column with type {@code Type.array(Type.pgOid())}. + * @throws NullPointerException if any element of the array value is {@code NULL}. If the array + * may contain {@code NULL} values, use {@link #getPgOidList(String)} instead. + */ + default long[] getPgOidArray(String columnName) { + throw new UnsupportedOperationException("method should be overwritten"); + }; + + /** + * @param columnIndex index of the column + * @return the value of a non-{@code NULL} column with type {@code Type.array(Type.pgOid())}. The + * list returned by this method is lazily constructed. Create a copy of it if you intend to + * access each element in the list multiple times. + */ + default List getPgOidList(int columnIndex) { + throw new UnsupportedOperationException("method should be overwritten"); + }; + + /** + * @param columnName + * @return the value of a non-{@code NULL} column with type {@code Type.array(Type.pgOid())}. The + * list returned by this method is lazily constructed. Create a copy of it if you intend to + * access each element in the list multiple times. + */ + default List getPgOidList(String columnName) { + throw new UnsupportedOperationException("method should be overwritten"); + }; + /** * @param columnIndex index of the column * @return the value of a non-{@code NULL} column with type {@code Type.array(Type.bytes())}. The diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Type.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Type.java index 24a81f09c6c..638b16ef326 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Type.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Type.java @@ -54,6 +54,7 @@ public final class Type implements Serializable { private static final Type TYPE_STRING = new Type(Code.STRING, null, null); private static final Type TYPE_JSON = new Type(Code.JSON, null, null); private static final Type TYPE_PG_JSONB = new Type(Code.PG_JSONB, null, null); + private static final Type TYPE_PG_OID = new Type(Code.PG_OID, null, null); private static final Type TYPE_BYTES = new Type(Code.BYTES, null, null); private static final Type TYPE_TIMESTAMP = new Type(Code.TIMESTAMP, null, null); private static final Type TYPE_DATE = new Type(Code.DATE, null, null); @@ -65,6 +66,7 @@ public final class Type implements Serializable { private static final Type TYPE_ARRAY_STRING = new Type(Code.ARRAY, TYPE_STRING, null); private static final Type TYPE_ARRAY_JSON = new Type(Code.ARRAY, TYPE_JSON, null); private static final Type TYPE_ARRAY_PG_JSONB = new Type(Code.ARRAY, TYPE_PG_JSONB, null); + private static final Type TYPE_ARRAY_PG_OID = new Type(Code.ARRAY, TYPE_PG_OID, null); private static final Type TYPE_ARRAY_BYTES = new Type(Code.ARRAY, TYPE_BYTES, null); private static final Type TYPE_ARRAY_TIMESTAMP = new Type(Code.ARRAY, TYPE_TIMESTAMP, null); private static final Type TYPE_ARRAY_DATE = new Type(Code.ARRAY, TYPE_DATE, null); @@ -127,6 +129,11 @@ public static Type pgJsonb() { return TYPE_PG_JSONB; } + /** Returns the descriptor for the {@code PG_OID} type. */ + public static Type pgOid() { + return TYPE_PG_OID; + } + /** Returns the descriptor for the {@code BYTES} type: a variable-length byte string. */ public static Type bytes() { return TYPE_BYTES; @@ -168,6 +175,8 @@ public static Type array(Type elementType) { return TYPE_ARRAY_JSON; case PG_JSONB: return TYPE_ARRAY_PG_JSONB; + case PG_OID: + return TYPE_ARRAY_PG_OID; case BYTES: return TYPE_ARRAY_BYTES; case TIMESTAMP: @@ -243,6 +252,7 @@ public enum Code { STRING(TypeCode.STRING), JSON(TypeCode.JSON), PG_JSONB(TypeCode.JSON, TypeAnnotationCode.PG_JSONB), + PG_OID(TypeCode.INT64, TypeAnnotationCode.PG_OID), BYTES(TypeCode.BYTES), TIMESTAMP(TypeCode.TIMESTAMP), DATE(TypeCode.DATE), @@ -501,6 +511,8 @@ static Type fromProto(com.google.spanner.v1.Type proto) { return json(); case PG_JSONB: return pgJsonb(); + case PG_OID: + return pgOid(); case BYTES: return bytes(); case TIMESTAMP: diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java index c30847d6fe3..21b77e00934 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java @@ -231,6 +231,20 @@ public static Value pgJsonb(@Nullable String v) { return new PgJsonbImpl(v == null, v); } + /** + * Returns an {@code PG_OID} value. + * + * @param v the value, which may be null + */ + public static Value pgOid(@Nullable Long v) { + return new PgOidImpl(v == null, v == null ? 0 : v); + } + + /** Returns an {@code PG_OID} value. */ + public static Value pgOid(long v) { + return new PgOidImpl(false, v); + } + /** * Returns a {@code BYTES} value. * @@ -450,6 +464,40 @@ public static Value pgJsonbArray(@Nullable Iterable v) { return new PgJsonbArrayImpl(v == null, v == null ? null : immutableCopyOf(v)); } + /** + * Returns an {@code ARRAY} value. + * + * @param v the source of element values, which may be null to produce a value for which {@code + * isNull()} is {@code true} + */ + public static Value pgOidArray(@Nullable long[] v) { + return pgOidArray(v, 0, v == null ? 0 : v.length); + } + + /** + * Returns an {@code ARRAY} value that takes its elements from a region of an array. + * + * @param v the source of element values, which may be null to produce a value for which {@code + * isNull()} is {@code true} + * @param pos the start position of {@code v} to copy values from. Ignored if {@code v} is {@code + * null}. + * @param length the number of values to copy from {@code v}. Ignored if {@code v} is {@code + * null}. + */ + public static Value pgOidArray(@Nullable long[] v, int pos, int length) { + return pgOidArrayFactory.create(v, pos, length); + } + + /** + * Returns an {@code ARRAY} value. + * + * @param v the source of element values. This may be {@code null} to produce a value for which + * {@code isNull()} is {@code true}. Individual elements may also be {@code null}. + */ + public static Value pgOidArray(@Nullable Iterable v) { + return pgOidArrayFactory.create(v); + } + /** * Returns an {@code ARRAY} value. * @@ -600,6 +648,13 @@ public String getPgJsonb() { throw new UnsupportedOperationException("Not implemented"); } + /** + * Returns the value of a {@code PG_OID}-typed instance. + * + * @throws IllegalStateException if {@code isNull()} or the value is not of the expected type + */ + public abstract long getPgOid(); + /** * Returns the value of a {@code BYTES}-typed instance. * @@ -692,6 +747,14 @@ public List getPgJsonbArray() { throw new UnsupportedOperationException("Not implemented"); } + /** + * Returns the value of an {@code ARRAY}-typed instance. While the returned list itself + * will never be {@code null}, elements of that list may be null. + * + * @throws IllegalStateException if {@code isNull()} or the value is not of the expected type + */ + public abstract List getPgOidArray(); + /** * Returns the value of an {@code ARRAY}-typed instance. While the returned list itself * will never be {@code null}, elements of that list may be null. @@ -844,6 +907,25 @@ Value newValue(boolean isNull, BitSet nulls, long[] values) { return new Int64ArrayImpl(isNull, nulls, values); } }; + + private static final PrimitiveArrayValueFactory pgOidArrayFactory = + new PrimitiveArrayValueFactory() { + @Override + long[] newArray(int size) { + return new long[size]; + } + + @Override + void set(long[] arr, int i, Long value) { + arr[i] = value; + } + + @Override + Value newValue(boolean isNull, BitSet nulls, long[] values) { + return new PgOidArrayImpl(isNull, nulls, values); + } + }; + private static final PrimitiveArrayValueFactory float64ArrayFactory = new PrimitiveArrayValueFactory() { @Override @@ -939,6 +1021,11 @@ public String getPgJsonb() { throw defaultGetter(Type.pgJsonb()); } + @Override + public long getPgOid() { + throw defaultGetter(Type.pgOid()); + } + @Override public ByteArray getBytes() { throw defaultGetter(Type.bytes()); @@ -998,6 +1085,11 @@ public List getPgJsonbArray() { throw defaultGetter(Type.array(Type.pgJsonb())); } + @Override + public List getPgOidArray() { + throw defaultGetter(Type.array(Type.pgOid())); + } + @Override public List getBytesArray() { throw defaultGetter(Type.array(Type.bytes())); @@ -1447,6 +1539,41 @@ void valueToString(StringBuilder b) { } } + private static class PgOidImpl extends AbstractValue { + private final long value; + + private PgOidImpl(boolean isNull, long value) { + super(isNull, Type.pgOid()); + this.value = value; + } + + @Override + public long getPgOid() { + checkNotNull(); + return value; + } + + @Override + com.google.protobuf.Value valueToProto() { + return com.google.protobuf.Value.newBuilder().setStringValue(Long.toString(value)).build(); + } + + @Override + void valueToString(StringBuilder b) { + b.append(value); + } + + @Override + boolean valueEquals(Value v) { + return ((PgOidImpl) v).value == value; + } + + @Override + int valueHash() { + return Long.valueOf(value).hashCode(); + } + } + private static class LazyBytesImpl extends AbstractObjectValue { private LazyBytesImpl(boolean isNull, LazyByteArray value) { @@ -1928,6 +2055,48 @@ void appendElement(StringBuilder b, String element) { } } + private static class PgOidArrayImpl extends PrimitiveArrayImpl { + private final long[] values; + + private PgOidArrayImpl(boolean isNull, BitSet nulls, long[] values) { + super(isNull, Type.pgOid(), nulls); + this.values = values; + } + + @Override + public List getPgOidArray() { + return getArray(); + } + + @Override + boolean valueEquals(Value v) { + PgOidArrayImpl that = (PgOidArrayImpl) v; + return Arrays.equals(values, that.values); + } + + @Override + int size() { + return values.length; + } + + @Override + Long getValue(int i) { + return values[i]; + } + + @Override + com.google.protobuf.Value getValueAsProto(int i) { + return com.google.protobuf.Value.newBuilder() + .setStringValue(Long.toString(values[i])) + .build(); + } + + @Override + int arrayHash() { + return Arrays.hashCode(values); + } + } + private static class LazyBytesArrayImpl extends AbstractArrayValue { private transient AbstractLazyInitializer> bytesArray = defaultInitializer(); @@ -2144,6 +2313,8 @@ private Value getValue(int fieldIndex) { return Value.numeric(value.getBigDecimal(fieldIndex)); case PG_NUMERIC: return Value.pgNumeric(value.getString(fieldIndex)); + case PG_OID: + return Value.pgOid(value.getPgOid(fieldIndex)); case DATE: return Value.date(value.getDate(fieldIndex)); case TIMESTAMP: @@ -2164,6 +2335,8 @@ private Value getValue(int fieldIndex) { return Value.jsonArray(value.getJsonList(fieldIndex)); case PG_JSONB: return Value.pgJsonbArray(value.getPgJsonbList(fieldIndex)); + case PG_OID: + return Value.pgOidArray(value.getPgOidList(fieldIndex)); case BYTES: return Value.bytesArray(value.getBytesList(fieldIndex)); case FLOAT64: diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ValueBinder.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ValueBinder.java index 07066470da6..2e7f6494f55 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ValueBinder.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ValueBinder.java @@ -199,6 +199,21 @@ public R toPgJsonbArray(@Nullable Iterable values) { return handle(Value.pgJsonbArray(values)); } + /** Binds to {@code Value.pgOidArray(values)} */ + public R toPgOidArray(@Nullable long[] values) { + return handle(Value.pgOidArray(values)); + } + + /** Binds to {@code Value.pgOidArray(values, pos, length)} */ + public R toPgOidArray(@Nullable long[] values, int pos, int length) { + return handle(Value.pgOidArray(values, pos, length)); + } + + /** Binds to {@code Value.pgOidArray(values)} */ + public R toPgOidArray(@Nullable Iterable values) { + return handle(Value.pgOidArray(values)); + } + /** Binds to {@code Value.bytesArray(values)} */ public R toBytesArray(@Nullable Iterable values) { return handle(Value.bytesArray(values)); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ChecksumResultSet.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ChecksumResultSet.java index bb2f2fb817a..ec8680f922e 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ChecksumResultSet.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ChecksumResultSet.java @@ -251,6 +251,9 @@ public void funnel(Struct row, PrimitiveSink into) { case PG_JSONB: funnelValue(type, row.getPgJsonb(i), into); break; + case PG_OID: + funnelValue(type, row.getPgOid(i), into); + break; case TIMESTAMP: funnelValue(type, row.getTimestamp(i), into); break; @@ -327,6 +330,12 @@ private void funnelArray( funnelValue(Code.PG_JSONB, value, into); } break; + case PG_OID: + into.putInt(row.getPgOidList(columnIndex).size()); + for (Long value : row.getPgOidList(columnIndex)) { + funnelValue(Code.PG_OID, value, into); + } + break; case TIMESTAMP: into.putInt(row.getTimestampList(columnIndex).size()); for (Timestamp value : row.getTimestampList(columnIndex)) { @@ -384,6 +393,9 @@ private void funnelValue(Code type, T value, PrimitiveSink into) { into.putInt(stringValue.length()); into.putUnencodedChars(stringValue); break; + case PG_OID: + into.putLong((Long) value); + break; case TIMESTAMP: Timestamp timestamp = (Timestamp) value; into.putLong(timestamp.getSeconds()).putInt(timestamp.getNanos()); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DirectExecuteResultSet.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DirectExecuteResultSet.java index 8690e154f4e..23dd0df62eb 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DirectExecuteResultSet.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DirectExecuteResultSet.java @@ -221,6 +221,18 @@ public String getPgJsonb(String columnName) { return delegate.getPgJsonb(columnName); } + @Override + public long getPgOid(int columnIndex) { + Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); + return delegate.getPgOid(columnIndex); + } + + @Override + public long getPgOid(String columnName) { + Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); + return delegate.getPgOid(columnName); + } + @Override public ByteArray getBytes(int columnIndex) { Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); @@ -389,6 +401,30 @@ public List getPgJsonbList(String columnName) { return delegate.getPgJsonbList(columnName); } + @Override + public long[] getPgOidArray(int columnIndex) { + Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); + return delegate.getPgOidArray(columnIndex); + } + + @Override + public long[] getPgOidArray(String columnName) { + Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); + return delegate.getPgOidArray(columnName); + } + + @Override + public List getPgOidList(int columnIndex) { + Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); + return delegate.getPgOidList(columnIndex); + } + + @Override + public List getPgOidList(String columnName) { + Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); + return delegate.getPgOidList(columnName); + } + @Override public List getBytesList(int columnIndex) { Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReplaceableForwardingResultSet.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReplaceableForwardingResultSet.java index 07e755b2b25..f6081db2ba6 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReplaceableForwardingResultSet.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReplaceableForwardingResultSet.java @@ -226,6 +226,18 @@ public String getPgJsonb(String columnName) { return delegate.getPgJsonb(columnName); } + @Override + public long getPgOid(int columnIndex) { + checkClosed(); + return delegate.getPgOid(columnIndex); + } + + @Override + public long getPgOid(String columnName) { + checkClosed(); + return delegate.getPgOid(columnName); + } + @Override public ByteArray getBytes(int columnIndex) { checkClosed(); @@ -394,6 +406,30 @@ public List getPgJsonbList(String columnName) { return delegate.getPgJsonbList(columnName); } + @Override + public long[] getPgOidArray(int columnIndex) { + checkClosed(); + return delegate.getPgOidArray(columnIndex); + } + + @Override + public long[] getPgOidArray(String columnName) { + checkClosed(); + return delegate.getPgOidArray(columnName); + } + + @Override + public List getPgOidList(int columnIndex) { + checkClosed(); + return delegate.getPgOidList(columnIndex); + } + + @Override + public List getPgOidList(String columnName) { + checkClosed(); + return delegate.getPgOidList(columnName); + } + @Override public List getBytesList(int columnIndex) { checkClosed(); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java index 1b6280a6369..026b4ac5a24 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java @@ -80,6 +80,11 @@ protected String getPgJsonbInternal(int columnIndex) { return null; } + @Override + protected long getPgOidInternal(int columnIndex) { + return 0; + } + @Override protected ByteArray getBytesInternal(int columnIndex) { return null; @@ -150,6 +155,16 @@ protected List getPgJsonbListInternal(int columnIndex) { return null; } + @Override + protected long[] getPgOidArrayInternal(int columnIndex) { + return null; + } + + @Override + protected List getPgOidListInternal(int columnIndex) { + return null; + } + @Override protected List getBytesListInternal(int columnIndex) { return null; @@ -238,6 +253,7 @@ public static Collection parameters() { "getJson", Collections.singletonList("getValue") }, + {Type.pgOid(), "getPgOidInternal", 123L, "getPgOid", Collections.singletonList("getValue")}, { Type.timestamp(), "getTimestampInternal", @@ -322,6 +338,13 @@ public static Collection parameters() { "getJsonList", Collections.singletonList("getValue") }, + { + Type.array(Type.pgOid()), + "getPgOidArrayInternal", + new long[] {1, 2}, + "getPgOidArray", + Arrays.asList("getPgOidList", "getValue") + }, { Type.array(Type.bytes()), "getBytesListInternal", diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java index aea8a4dcb64..23308c0419e 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java @@ -3638,212 +3638,235 @@ public void testByteArray() { public void testGetAllTypesAsString() { for (Dialect dialect : Dialect.values()) { Statement statement = Statement.of("select * from all_types"); - mockSpanner.putStatementResult( - StatementResult.query( - statement, - com.google.spanner.v1.ResultSet.newBuilder() - .setMetadata( - RandomResultSetGenerator.generateAllTypesMetadata( - RandomResultSetGenerator.generateAllTypes(dialect))) - .addRows( + ListValue.Builder dialectBasedBuilder = ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder().setBoolValue(true).build()) + .addValues( + com.google.protobuf.Value.newBuilder().setStringValue("100").build()) + .addValues( + com.google.protobuf.Value.newBuilder().setNumberValue(3.14d).build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("6.626") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("test-string") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("{\"key1\": \"value1\"}") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue( + Base64.getEncoder() + .encodeToString( + "test-bytes".getBytes(StandardCharsets.UTF_8))) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("2023-01-11") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("2023-01-11T11:55:18.123456789Z") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setBoolValue(true) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setBoolValue(false) + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MAX_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MIN_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( ListValue.newBuilder() .addValues( - com.google.protobuf.Value.newBuilder().setBoolValue(true).build()) + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) .addValues( - com.google.protobuf.Value.newBuilder().setStringValue("100").build()) + com.google.protobuf.Value.newBuilder() + .setNumberValue(-12345.6789d) + .build()) .addValues( - com.google.protobuf.Value.newBuilder().setNumberValue(3.14d).build()) + com.google.protobuf.Value.newBuilder() + .setNumberValue(3.14d) + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() .addValues( com.google.protobuf.Value.newBuilder() .setStringValue("6.626") .build()) .addValues( com.google.protobuf.Value.newBuilder() - .setStringValue("test-string") + .setNullValue(NullValue.NULL_VALUE) .build()) .addValues( com.google.protobuf.Value.newBuilder() - .setStringValue("{\"key1\": \"value1\"}") + .setStringValue("-8.9123") .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() .addValues( com.google.protobuf.Value.newBuilder() - .setStringValue( - Base64.getEncoder() - .encodeToString( - "test-bytes".getBytes(StandardCharsets.UTF_8))) + .setStringValue("test-string1") .build()) .addValues( com.google.protobuf.Value.newBuilder() - .setStringValue("2023-01-11") + .setNullValue(NullValue.NULL_VALUE) .build()) .addValues( com.google.protobuf.Value.newBuilder() - .setStringValue("2023-01-11T11:55:18.123456789Z") + .setStringValue("test-string2") + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("{\"key\": \"value1\"}") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("{\"key\": \"value2\"}") .build()) .addValues( com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setBoolValue(true) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setBoolValue(false) - .build()) - .build())) + .setNullValue(NullValue.NULL_VALUE) + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue( + Base64.getEncoder() + .encodeToString( + "test-bytes1" + .getBytes( + StandardCharsets.UTF_8))) + .build()) .addValues( com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue(String.valueOf(Long.MAX_VALUE)) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue(String.valueOf(Long.MIN_VALUE)) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .build())) + .setStringValue( + Base64.getEncoder() + .encodeToString( + "test-bytes2" + .getBytes( + StandardCharsets.UTF_8))) + .build()) .addValues( com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNumberValue(-12345.6789d) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNumberValue(3.14d) - .build()) - .build())) + .setNullValue(NullValue.NULL_VALUE) + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() .addValues( com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("6.626") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("-8.9123") - .build()) - .build())) + .setStringValue("2000-02-29") + .build()) .addValues( com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("test-string1") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("test-string2") - .build()) - .build())) + .setNullValue(NullValue.NULL_VALUE) + .build()) .addValues( com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("{\"key\": \"value1\"}") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("{\"key\": \"value2\"}") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .build())) + .setStringValue("2000-01-01") + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() .addValues( com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue( - Base64.getEncoder() - .encodeToString( - "test-bytes1" - .getBytes( - StandardCharsets.UTF_8))) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue( - Base64.getEncoder() - .encodeToString( - "test-bytes2" - .getBytes( - StandardCharsets.UTF_8))) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .build())) + .setStringValue("2023-01-11T11:55:18.123456789Z") + .build()) .addValues( com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2000-02-29") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2000-01-01") - .build()) - .build())) + .setNullValue(NullValue.NULL_VALUE) + .build()) .addValues( com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2023-01-11T11:55:18.123456789Z") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2023-01-12T11:55:18Z") - .build()) - .build())) - .build()) + .setStringValue("2023-01-12T11:55:18Z") + .build()) + .build())); + + if (dialect == Dialect.POSTGRESQL) { + dialectBasedBuilder = dialectBasedBuilder + .addValues( + com.google.protobuf.Value.newBuilder().setStringValue("100").build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MAX_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MIN_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .build())); + } + + mockSpanner.putStatementResult( + StatementResult.query( + statement, + com.google.spanner.v1.ResultSet.newBuilder() + .setMetadata( + RandomResultSetGenerator.generateAllTypesMetadata( + RandomResultSetGenerator.generateAllTypes(dialect))) + .addRows(dialectBasedBuilder.build()) .build())); DatabaseClient client = @@ -3896,6 +3919,15 @@ public void testGetAllTypesAsString() { resultSet, col++); + if (dialect == Dialect.POSTGRESQL) { + assertAsString("100", resultSet, col++); + assertAsString( + ImmutableList.of( + String.format("%d", Long.MAX_VALUE), String.format("%d", Long.MIN_VALUE), "NULL"), + resultSet, + col++); + } + assertFalse(resultSet.next()); } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java index 82300a93090..dc458a83262 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java @@ -765,6 +765,22 @@ public void getPgJsonb() { assertEquals("[]", resultSet.getPgJsonb(0)); } + @Test + public void getPgOid() { + consumer.onPartialResultSet( + PartialResultSet.newBuilder() + .setMetadata(makeMetadata(Type.struct(Type.StructField.of("f", Type.pgOid())))) + .addValues(Value.pgOid(Long.MIN_VALUE).toProto()) + .addValues(Value.pgOid(Long.MAX_VALUE).toProto()) + .build()); + consumer.onCompleted(); + + assertThat(resultSet.next()).isTrue(); + assertThat(resultSet.getPgOid(0)).isEqualTo(Long.MIN_VALUE); + assertThat(resultSet.next()).isTrue(); + assertThat(resultSet.getPgOid(0)).isEqualTo(Long.MAX_VALUE); + } + @Test public void getBooleanArray() { boolean[] boolArray = {true, true, false}; @@ -906,4 +922,19 @@ public void getPgJsonbList() { assertTrue(resultSet.next()); assertEquals(jsonList, resultSet.getPgJsonbList(0)); } + + @Test + public void getPgOidArray() { + long[] longArray = {111, 333, 444, 0, -1, -2234, Long.MAX_VALUE, Long.MIN_VALUE}; + + consumer.onPartialResultSet( + PartialResultSet.newBuilder() + .setMetadata( + makeMetadata(Type.struct(Type.StructField.of("f", Type.array(Type.pgOid()))))) + .addValues(Value.pgOidArray(longArray).toProto()) + .build()); + consumer.onCompleted(); + assertThat(resultSet.next()).isTrue(); + assertThat(resultSet.getPgOidArray(0)).isEqualTo(longArray); + } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MutationTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MutationTest.java index fe2b7aec94b..e14815c268d 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MutationTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MutationTest.java @@ -549,6 +549,10 @@ private Mutation.WriteBuilder appendAllTypes(Mutation.WriteBuilder builder) { .to(Value.pgJsonb("{\"key\": \"value\"}}")) .set("pgJsonbNull") .to(Value.pgJsonb(null)) + .set("pgOid") + .to(Value.pgOid(42)) + .set("pgOidNull") + .to(Value.pgOid(null)) .set("timestamp") .to(Timestamp.MAX_VALUE) .set("timestampNull") @@ -609,6 +613,12 @@ private Mutation.WriteBuilder appendAllTypes(Mutation.WriteBuilder builder) { .toPgJsonbArray(null) .set("pgJsonbArrValue") .to(Value.pgJsonbArray(ImmutableList.of("{\"key\": \"value1\"}}", "{\"key\": \"value2\"}"))) + .set("pgOidArr") + .toPgOidArray(new long[] {1, 2, 3}) + .set("pgOidArrNull") + .toPgOidArray((long[]) null) + .set("pgOidArrValue") + .to(Value.pgOidArray(ImmutableList.of(1L, 2L))) .set("timestampArr") .toTimestampArray(ImmutableList.of(Timestamp.MAX_VALUE, Timestamp.MAX_VALUE)) .set("timestampArrNull") diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsTest.java index 87be602808c..2ff7bf1a639 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsTest.java @@ -91,6 +91,7 @@ public void resultSetIteration() { Type.StructField.of("stringVal", Type.string()), Type.StructField.of("jsonVal", Type.json()), Type.StructField.of("pgJsonbVal", Type.pgJsonb()), + Type.StructField.of("pgOidVal", Type.pgOid()), Type.StructField.of("byteVal", Type.bytes()), Type.StructField.of("timestamp", Type.timestamp()), Type.StructField.of("date", Type.date()), @@ -103,7 +104,8 @@ public void resultSetIteration() { Type.StructField.of("dateArray", Type.array(Type.date())), Type.StructField.of("stringArray", Type.array(Type.string())), Type.StructField.of("jsonArray", Type.array(Type.json())), - Type.StructField.of("pgJsonbArray", Type.array(Type.pgJsonb()))); + Type.StructField.of("pgJsonbArray", Type.array(Type.pgJsonb())), + Type.StructField.of("pgOidArray", Type.array(Type.pgOid()))); Struct struct1 = Struct.newBuilder() .set("f1") @@ -122,6 +124,8 @@ public void resultSetIteration() { .to(Value.json(jsonVal)) .set("pgJsonbVal") .to(Value.pgJsonb(jsonVal)) + .set("pgOidVal") + .to(Value.pgOid(2)) .set("byteVal") .to(Value.bytes(ByteArray.copyFrom(byteVal))) .set("timestamp") @@ -148,6 +152,8 @@ public void resultSetIteration() { .to(Value.jsonArray(Arrays.asList(jsonArray))) .set("pgJsonbArray") .to(Value.pgJsonbArray(Arrays.asList(jsonArray))) + .set("pgOidArray") + .to(Value.pgOidArray(longArray)) .build(); Struct struct2 = Struct.newBuilder() @@ -167,6 +173,8 @@ public void resultSetIteration() { .to(Value.json(jsonVal)) .set("pgJsonbVal") .to(Value.pgJsonb(jsonVal)) + .set("pgOidVal") + .to(Value.pgOid(3)) .set("byteVal") .to(Value.bytes(ByteArray.copyFrom(byteVal))) .set("timestamp") @@ -193,6 +201,8 @@ public void resultSetIteration() { .to(Value.jsonArray(Arrays.asList(jsonArray))) .set("pgJsonbArray") .to(Value.pgJsonbArray(Arrays.asList(jsonArray))) + .set("pgOidArray") + .to(Value.pgOidArray(longArray)) .build(); ResultSet rs = ResultSets.forRows(type, Arrays.asList(struct1, struct2)); @@ -244,6 +254,10 @@ public void resultSetIteration() { assertEquals(jsonVal, rs.getPgJsonb("pgJsonbVal")); assertEquals(Value.pgJsonb(jsonVal), rs.getValue("pgJsonbVal")); + assertThat(rs.getPgOid(columnIndex)).isEqualTo(2L); + assertThat(rs.getValue(columnIndex++)).isEqualTo(Value.pgOid(2L)); + assertThat(rs.getColumnType("pgOidVal")).isEqualTo(Type.pgOid()); + assertThat(rs.getBytes(columnIndex)).isEqualTo(ByteArray.copyFrom(byteVal)); assertThat(rs.getValue(columnIndex++)).isEqualTo(Value.bytes(ByteArray.copyFrom(byteVal))); assertThat(rs.getBytes("byteVal")).isEqualTo(ByteArray.copyFrom(byteVal)); @@ -305,9 +319,16 @@ public void resultSetIteration() { assertThat(rs.getJsonList(columnIndex++)).isEqualTo(Arrays.asList(jsonArray)); assertThat(rs.getJsonList("jsonArray")).isEqualTo(Arrays.asList(jsonArray)); - assertEquals(Arrays.asList(jsonArray), rs.getPgJsonbList(columnIndex)); + assertEquals(Arrays.asList(jsonArray), rs.getPgJsonbList(columnIndex++)); assertEquals(Arrays.asList(jsonArray), rs.getPgJsonbList("pgJsonbArray")); + assertThat(rs.getPgOidArray(columnIndex)).isEqualTo(longArray); + assertThat(rs.getValue(columnIndex)).isEqualTo(Value.pgOidArray(longArray)); + assertThat(rs.getPgOidArray("pgOidArray")).isEqualTo(longArray); + assertThat(rs.getValue("pgOidArray")).isEqualTo(Value.pgOidArray(longArray)); + assertThat(rs.getPgOidList(columnIndex++)).isEqualTo(Longs.asList(longArray)); + assertThat(rs.getPgOidList("pgOidArray")).isEqualTo(Longs.asList(longArray)); + assertThat(rs.next()).isTrue(); assertThat(rs.getCurrentRowAsStruct()).isEqualTo(struct2); assertThat(rs.getString(0)).isEqualTo("y"); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/TypeTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/TypeTest.java index eb17a7a8c62..6c3995fd285 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/TypeTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/TypeTest.java @@ -164,6 +164,16 @@ Type newType() { }.test(); } + @Test + public void pgOid() { + new ScalarTypeTester(Type.Code.PG_OID, TypeCode.INT64, TypeAnnotationCode.PG_OID) { + @Override + Type newType() { + return Type.pgOid(); + } + }.test(); + } + @Test public void bytes() { new ScalarTypeTester(Type.Code.BYTES, TypeCode.BYTES) { diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueBinderTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueBinderTest.java index 8da5c0322dc..79e94f8e249 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueBinderTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueBinderTest.java @@ -19,6 +19,7 @@ import static com.google.cloud.spanner.ValueBinderTest.DefaultValues.defaultBytesBase64; import static com.google.cloud.spanner.ValueBinderTest.DefaultValues.defaultJson; import static com.google.cloud.spanner.ValueBinderTest.DefaultValues.defaultPgJsonb; +import static com.google.cloud.spanner.ValueBinderTest.DefaultValues.defaultLongWrapper; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; @@ -42,6 +43,7 @@ public class ValueBinderTest { private static final String JSON_METHOD_NAME = "json"; private static final String PG_JSONB_METHOD_NAME = "pgJsonb"; + private static final String PG_OID_METHOD_NAME = "pgOid"; private static final String PG_NUMERIC_METHOD_NAME = "pgNumeric"; private static final String BYTES_BASE64_METHOD_NAME = "bytesFromBase64"; public static final String DEFAULT_PG_NUMERIC = "1.23"; @@ -134,6 +136,9 @@ public void reflection() } else if (method.getName().equalsIgnoreCase(PG_JSONB_METHOD_NAME)) { binderMethod = ValueBinder.class.getMethod("to", Value.class); assertThat(binderMethod.invoke(binder, Value.pgJsonb(null))).isEqualTo(lastReturnValue); + } else if (method.getName().equalsIgnoreCase(PG_OID_METHOD_NAME)) { + binderMethod = ValueBinder.class.getMethod("to", Value.class); + assertThat(binderMethod.invoke(binder, Value.pgOid(null))).isEqualTo(lastReturnValue); } else if (method.getName().equalsIgnoreCase(PG_NUMERIC_METHOD_NAME)) { binderMethod = ValueBinder.class.getMethod("to", Value.class); assertThat(binderMethod.invoke(binder, Value.pgNumeric(null))) @@ -163,6 +168,11 @@ public void reflection() binderMethod = ValueBinder.class.getMethod("to", Value.class); assertThat(binderMethod.invoke(binder, Value.pgJsonb(defaultPgJsonb()))) .isEqualTo(lastReturnValue); + } else if (method.getName().equalsIgnoreCase(PG_OID_METHOD_NAME)) { + defaultObject = defaultLongWrapper(); + binderMethod = ValueBinder.class.getMethod("to", Value.class); + assertThat(binderMethod.invoke(binder, Value.pgOid(defaultLongWrapper()))) + .isEqualTo(lastReturnValue); } else if (method.getName().equalsIgnoreCase(PG_NUMERIC_METHOD_NAME)) { defaultObject = DEFAULT_PG_NUMERIC; binderMethod = ValueBinder.class.getMethod("to", Value.class); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java index bf806795fa6..ef56cb4fbce 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java @@ -578,6 +578,27 @@ public void testPgJsonbNested() { assertEquals(json, v.getAsString()); } + @Test + public void testPgOid() { + Value v = Value.pgOid(Long.valueOf(123)); + assertThat(v.getType()).isEqualTo(Type.pgOid()); + assertThat(v.isNull()).isFalse(); + assertThat(v.getPgOid()).isEqualTo(123); + assertThat(v.toString()).isEqualTo("123"); + assertEquals("123", v.getAsString()); + } + + @Test + public void testPgOidNull() { + Value v = Value.pgOid(null); + assertThat(v.getType()).isEqualTo(Type.pgOid()); + assertThat(v.isNull()).isTrue(); + assertThat(v.toString()).isEqualTo(NULL_STRING); + IllegalStateException e = assertThrows(IllegalStateException.class, v::getPgOid); + assertThat(e.getMessage()).contains("null value"); + assertEquals("NULL", v.getAsString()); + } + @Test public void bytes() { ByteArray bytes = newByteArray("abc"); @@ -1050,6 +1071,67 @@ public void testPgJsonbArrayTryGetFloat64Array() { value::getFloat64Array, "Expected: ARRAY actual: ARRAY>"); } + @Test + public void pgOidArray() { + Value v = Value.pgOidArray(new long[] {1, 2}); + assertThat(v.isNull()).isFalse(); + assertThat(v.getPgOidArray()).containsExactly(1L, 2L).inOrder(); + assertThat(v.toString()).isEqualTo("[1,2]"); + assertEquals("[1,2]", v.getAsString()); + } + + @Test + public void pgOidArrayRange() { + Value v = Value.pgOidArray(new long[] {1, 2, 3, 4, 5}, 1, 3); + assertThat(v.isNull()).isFalse(); + assertThat(v.getPgOidArray()).containsExactly(2L, 3L, 4L).inOrder(); + assertThat(v.toString()).isEqualTo("[2,3,4]"); + assertEquals("[2,3,4]", v.getAsString()); + } + + @Test + public void pgOidArrayNull() { + Value v = Value.pgOidArray((long[]) null); + assertThat(v.isNull()).isTrue(); + assertThat(v.toString()).isEqualTo(NULL_STRING); + IllegalStateException e = assertThrows(IllegalStateException.class, v::getPgOidArray); + assertThat(e.getMessage()).contains("null value"); + assertEquals("NULL", v.getAsString()); + } + + @Test + public void pgOidArrayWrapper() { + Value v = Value.pgOidArray(Arrays.asList(1L, null, 3L)); + assertThat(v.isNull()).isFalse(); + assertThat(v.getPgOidArray()).containsExactly(1L, null, 3L).inOrder(); + assertThat(v.toString()).isEqualTo("[1,NULL,3]"); + assertEquals("[1,NULL,3]", v.getAsString()); + } + + @Test + public void pgOidArrayWrapperNull() { + Value v = Value.pgOidArray((Iterable) null); + assertThat(v.isNull()).isTrue(); + assertThat(v.toString()).isEqualTo(NULL_STRING); + IllegalStateException e = assertThrows(IllegalStateException.class, v::getPgOidArray); + assertThat(e.getMessage()).contains("null value"); + assertEquals("NULL", v.getAsString()); + } + + @Test + public void pgOidArrayTryGetBool() { + Value value = Value.pgOidArray(Collections.singletonList(1234L)); + IllegalStateException e = assertThrows(IllegalStateException.class, value::getBool); + assertThat(e.getMessage()).contains("Expected: BOOL actual: ARRAY>"); + } + + @Test + public void pgOidArrayNullTryGetBool() { + Value value = Value.pgOidArray((Iterable) null); + IllegalStateException e = assertThrows(IllegalStateException.class, value::getBool); + assertThat(e.getMessage()).contains("Expected: BOOL actual: ARRAY>"); + } + @Test public void bytesArray() { ByteArray a = newByteArray("a"); @@ -1770,6 +1852,10 @@ public void testEqualsHashCode() { tester.addEqualityGroup(Value.pgNumeric("8765.4321")); tester.addEqualityGroup(Value.pgNumeric(null)); + tester.addEqualityGroup(Value.pgOid(123L), Value.pgOid(Long.valueOf(123))); + tester.addEqualityGroup(Value.pgOid(456L)); + tester.addEqualityGroup(Value.pgOid(null)); + tester.addEqualityGroup(Value.string("abc"), Value.string("abc")); tester.addEqualityGroup(Value.string("def")); tester.addEqualityGroup(Value.string(null)); @@ -1842,6 +1928,15 @@ public void testEqualsHashCode() { tester.addEqualityGroup(Value.pgNumericArray(Collections.singletonList("1.25"))); tester.addEqualityGroup(Value.pgNumericArray(null), Value.pgNumericArray(null)); + tester.addEqualityGroup( + Value.pgOidArray(Arrays.asList(1L, 2L)), + Value.pgOidArray(new long[] {1L, 2L}), + Value.pgOidArray(new long[] {0L, 1L, 2L, 3L}, 1, 2), + Value.pgOidArray(plainIterable(1L, 2L))); + tester.addEqualityGroup(Value.pgOidArray(Collections.singletonList(3L))); + tester.addEqualityGroup(Value.pgOidArray(Collections.singletonList(null))); + tester.addEqualityGroup(Value.pgOidArray((Iterable) null)); + tester.addEqualityGroup( Value.stringArray(Arrays.asList("a", "b")), Value.stringArray(Arrays.asList("a", "b"))); tester.addEqualityGroup(Value.stringArray(Collections.singletonList("c"))); @@ -1906,6 +2001,10 @@ public void testGetAsString() { assertEquals("123456789.123456789", Value.pgNumeric("123456789.123456789").getAsString()); assertEquals("NaN", Value.pgNumeric("NaN").getAsString()); + assertEquals("1", Value.pgOid(1L).getAsString()); + assertEquals(String.valueOf(Long.MAX_VALUE), Value.pgOid(Long.MAX_VALUE).getAsString()); + assertEquals(String.valueOf(Long.MIN_VALUE), Value.pgOid(Long.MIN_VALUE).getAsString()); + assertEquals(Strings.repeat("foo", 36), Value.string(Strings.repeat("foo", 36)).getAsString()); assertEquals(Strings.repeat("foo", 36), Value.json(Strings.repeat("foo", 36)).getAsString()); assertEquals(Strings.repeat("foo", 36), Value.pgJsonb(Strings.repeat("foo", 36)).getAsString()); @@ -1946,6 +2045,9 @@ public void serialization() { reserializeAndAssert(Value.pgNumeric(Value.NAN)); reserializeAndAssert(Value.pgNumeric(null)); + reserializeAndAssert(Value.pgOid(123L)); + reserializeAndAssert(Value.pgOid(null)); + reserializeAndAssert(Value.string("abc")); reserializeAndAssert(Value.string(null)); @@ -1991,6 +2093,10 @@ public void serialization() { Value.pgNumericArray(BrokenSerializationList.of("1.23", "1.24", Value.NAN))); reserializeAndAssert(Value.pgNumericArray(null)); + reserializeAndAssert(Value.pgOidArray(BrokenSerializationList.of(Long.valueOf(1L), Long.valueOf(2L)))); + reserializeAndAssert(Value.pgOidArray(BrokenSerializationList.of(Long.valueOf(1L), Long.valueOf(2L), null))); + reserializeAndAssert(Value.pgOidArray((Iterable) null)); + reserializeAndAssert(Value.timestamp(null)); reserializeAndAssert(Value.timestamp(Value.COMMIT_TIMESTAMP)); reserializeAndAssert(Value.timestamp(Timestamp.now())); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ChecksumResultSetTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ChecksumResultSetTest.java index 1f3f59e96ab..6eaee40499c 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ChecksumResultSetTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ChecksumResultSetTest.java @@ -65,6 +65,8 @@ public class ChecksumResultSetTest { .to(Value.json("{\"color\":\"red\",\"value\":\"#ff0\"}")) .set("pgJsonbVal") .to(Value.pgJsonb("{\"color\":\"red\",\"value\":\"#00f\"}")) + .set("pgOidVal") + .to(Value.pgOid(2 * 2)) .set("byteVal") .to(Value.bytes(ByteArray.copyFrom("bytes".getBytes(StandardCharsets.UTF_8)))) .set("timestamp") @@ -104,6 +106,8 @@ public class ChecksumResultSetTest { .to( Value.pgJsonbArray( Arrays.asList("{\"color\":\"red\",\"value\":\"#f00\"}", null, "[]"))) + .set("pgOidArray") + .to(Value.pgOidArray(Arrays.asList(2L, null, 1L, 0L))) .build(); @Test @@ -118,6 +122,7 @@ public void testRetry() { Type.StructField.of("stringVal", Type.string()), Type.StructField.of("jsonVal", Type.json()), Type.StructField.of("pgJsonbVal", Type.pgJsonb()), + Type.StructField.of("pgOidVal", Type.pgOid()), Type.StructField.of("byteVal", Type.bytes()), Type.StructField.of("timestamp", Type.timestamp()), Type.StructField.of("date", Type.date()), @@ -131,7 +136,8 @@ public void testRetry() { Type.StructField.of("dateArray", Type.array(Type.date())), Type.StructField.of("stringArray", Type.array(Type.string())), Type.StructField.of("jsonArray", Type.array(Type.json())), - Type.StructField.of("pgJsonbArray", Type.array(Type.pgJsonb()))); + Type.StructField.of("pgJsonbArray", Type.array(Type.pgJsonb())), + Type.StructField.of("pgOidArray", Type.array(Type.pgOid()))); Struct rowNonNullValues = Struct.newBuilder() .set("boolVal") @@ -150,6 +156,8 @@ public void testRetry() { .to(Value.json("{\"color\":\"red\",\"value\":\"#f00\"}")) .set("pgJsonbVal") .to(Value.pgJsonb("{\"color\":\"red\",\"value\":\"#f00\"}")) + .set("pgOidVal") + .to(Value.pgOid(2)) .set("byteVal") .to(Value.bytes(ByteArray.copyFrom("test".getBytes(StandardCharsets.UTF_8)))) .set("timestamp") @@ -192,6 +200,8 @@ public void testRetry() { .to( Value.pgJsonbArray( Arrays.asList("{\"color\":\"red\",\"value\":\"#f00\"}", null, "{}"))) + .set("pgOidArray") + .to(Value.pgOidArray(Arrays.asList(1L, null, 2L))) .build(); Struct rowNullValues = Struct.newBuilder() @@ -211,6 +221,8 @@ public void testRetry() { .to(Value.json(null)) .set("pgJsonbVal") .to(Value.pgJsonb(null)) + .set("pgOidVal") + .to(Value.pgOid(null)) .set("byteVal") .to((ByteArray) null) .set("timestamp") @@ -239,6 +251,8 @@ public void testRetry() { .toJsonArray(null) .set("pgJsonbArray") .toPgJsonbArray(null) + .set("pgOidArray") + .toPgOidArray((Iterable) null) .build(); ParsedStatement parsedStatement = mock(ParsedStatement.class); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DirectExecuteResultSetTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DirectExecuteResultSetTest.java index 346055060ab..23e42872e29 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DirectExecuteResultSetTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DirectExecuteResultSetTest.java @@ -261,6 +261,19 @@ public void testValidMethodCall() throws IllegalArgumentException { subject.getPgJsonbList("test2"); verify(delegate).getPgJsonbList("test2"); + subject.getPgOid(0); + verify(delegate).getPgOid(0); + subject.getPgOid("test0"); + verify(delegate).getPgOid("test0"); + subject.getPgOidArray(1); + verify(delegate).getPgOidArray(1); + subject.getPgOidArray("test1"); + verify(delegate).getPgOidArray("test1"); + subject.getPgOidList(2); + verify(delegate).getPgOidList(2); + subject.getPgOidList("test2"); + verify(delegate).getPgOidList("test2"); + subject.getStructList(0); subject.getStructList("test0"); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java index f8415fb00eb..77bad9d4360 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java @@ -32,6 +32,9 @@ import com.google.spanner.v1.TypeAnnotationCode; import com.google.spanner.v1.TypeCode; import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import java.util.Random; /** @@ -40,73 +43,88 @@ */ public class RandomResultSetGenerator { public static Type[] generateAllTypes(Dialect dialect) { - return new Type[] { - Type.newBuilder().setCode(TypeCode.BOOL).build(), - Type.newBuilder().setCode(TypeCode.INT64).build(), - Type.newBuilder().setCode(TypeCode.FLOAT64).build(), - dialect == Dialect.POSTGRESQL - ? Type.newBuilder() - .setCode(TypeCode.NUMERIC) - .setTypeAnnotation(TypeAnnotationCode.PG_NUMERIC) - .build() - : Type.newBuilder().setCode(TypeCode.NUMERIC).build(), - Type.newBuilder().setCode(TypeCode.STRING).build(), - dialect == Dialect.POSTGRESQL - ? Type.newBuilder() - .setCode(TypeCode.JSON) - .setTypeAnnotation(TypeAnnotationCode.PG_JSONB) - .build() - : Type.newBuilder().setCode(TypeCode.JSON).build(), - Type.newBuilder().setCode(TypeCode.BYTES).build(), - Type.newBuilder().setCode(TypeCode.DATE).build(), - Type.newBuilder().setCode(TypeCode.TIMESTAMP).build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.BOOL)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.INT64)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.FLOAT64)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType( - dialect == Dialect.POSTGRESQL - ? Type.newBuilder() - .setCode(TypeCode.NUMERIC) - .setTypeAnnotation(TypeAnnotationCode.PG_NUMERIC) - : Type.newBuilder().setCode(TypeCode.NUMERIC)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.STRING)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType( - dialect == Dialect.POSTGRESQL - ? Type.newBuilder() - .setCode(TypeCode.JSON) - .setTypeAnnotation(TypeAnnotationCode.PG_JSONB) - : Type.newBuilder().setCode(TypeCode.JSON)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.BYTES)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.DATE)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.TIMESTAMP)) - .build(), - }; + List allTypes = new ArrayList<>(); + allTypes.addAll(Arrays.asList( + Type.newBuilder().setCode(TypeCode.BOOL).build(), + Type.newBuilder().setCode(TypeCode.INT64).build(), + Type.newBuilder().setCode(TypeCode.FLOAT64).build(), + dialect == Dialect.POSTGRESQL + ? Type.newBuilder() + .setCode(TypeCode.NUMERIC) + .setTypeAnnotation(TypeAnnotationCode.PG_NUMERIC) + .build() + : Type.newBuilder().setCode(TypeCode.NUMERIC).build(), + Type.newBuilder().setCode(TypeCode.STRING).build(), + dialect == Dialect.POSTGRESQL + ? Type.newBuilder() + .setCode(TypeCode.JSON) + .setTypeAnnotation(TypeAnnotationCode.PG_JSONB) + .build() + : Type.newBuilder().setCode(TypeCode.JSON).build(), + Type.newBuilder().setCode(TypeCode.BYTES).build(), + Type.newBuilder().setCode(TypeCode.DATE).build(), + Type.newBuilder().setCode(TypeCode.TIMESTAMP).build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.BOOL)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.INT64)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.FLOAT64)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType( + dialect == Dialect.POSTGRESQL + ? Type.newBuilder() + .setCode(TypeCode.NUMERIC) + .setTypeAnnotation(TypeAnnotationCode.PG_NUMERIC) + : Type.newBuilder().setCode(TypeCode.NUMERIC)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.STRING)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType( + dialect == Dialect.POSTGRESQL + ? Type.newBuilder() + .setCode(TypeCode.JSON) + .setTypeAnnotation(TypeAnnotationCode.PG_JSONB) + : Type.newBuilder().setCode(TypeCode.JSON)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.BYTES)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.DATE)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.TIMESTAMP)) + .build())); + if (dialect == Dialect.POSTGRESQL) { + allTypes.addAll(Arrays.asList( + Type.newBuilder() + .setCode(TypeCode.INT64) + .setTypeAnnotation(TypeAnnotationCode.PG_OID) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType( + Type.newBuilder() + .setCode(TypeCode.INT64) + .setTypeAnnotation(TypeAnnotationCode.PG_OID)) + .build())); + } + return allTypes.toArray(new Type[0]); } public static ResultSetMetadata generateAllTypesMetadata(Type[] types) { diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java index a691fbf78b4..2d0bcfa5cd6 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java @@ -254,6 +254,19 @@ public void bindInt64Null() { assertThat(row.isNull(0)).isTrue(); } + @Test + public void bindPgOid() { + Struct row = execute(Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(1234)), Type.pgOid()); + assertThat(row.isNull(0)).isFalse(); + assertThat(row.getPgOid(0)).isEqualTo(1234); + } + + @Test + public void bindPgOidNull() { + Struct row = execute(Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(null)), Type.pgOid()); + assertThat(row.isNull(0)).isTrue(); + } + @Test public void bindFloat64() { Struct row = execute(Statement.newBuilder(selectValueQuery).bind("p1").to(2.0), Type.float64()); From 929abf462e00af61c89035a3168f902c4054deec Mon Sep 17 00:00:00 2001 From: Quynh Tran Date: Tue, 21 Nov 2023 10:36:07 +1100 Subject: [PATCH 02/47] chore: fix lint errors --- .../java/com/google/cloud/spanner/Value.java | 10 +- .../AbstractStructReaderTypesTest.java | 8 +- .../cloud/spanner/DatabaseClientImplTest.java | 418 +++++++++--------- .../cloud/spanner/GrpcResultSetTest.java | 10 +- .../google/cloud/spanner/MutationTest.java | 2 +- .../google/cloud/spanner/ValueBinderTest.java | 2 +- .../com/google/cloud/spanner/ValueTest.java | 14 +- .../connection/RandomResultSetGenerator.java | 158 +++---- .../google/cloud/spanner/it/ITQueryTest.java | 8 +- 9 files changed, 314 insertions(+), 316 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java index 21b77e00934..bf0b1326df0 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java @@ -231,7 +231,7 @@ public static Value pgJsonb(@Nullable String v) { return new PgJsonbImpl(v == null, v); } - /** + /** * Returns an {@code PG_OID} value. * * @param v the value, which may be null @@ -925,7 +925,7 @@ Value newValue(boolean isNull, BitSet nulls, long[] values) { return new PgOidArrayImpl(isNull, nulls, values); } }; - + private static final PrimitiveArrayValueFactory float64ArrayFactory = new PrimitiveArrayValueFactory() { @Override @@ -2087,8 +2087,8 @@ Long getValue(int i) { @Override com.google.protobuf.Value getValueAsProto(int i) { return com.google.protobuf.Value.newBuilder() - .setStringValue(Long.toString(values[i])) - .build(); + .setStringValue(Long.toString(values[i])) + .build(); } @Override @@ -2335,7 +2335,7 @@ private Value getValue(int fieldIndex) { return Value.jsonArray(value.getJsonList(fieldIndex)); case PG_JSONB: return Value.pgJsonbArray(value.getPgJsonbList(fieldIndex)); - case PG_OID: + case PG_OID: return Value.pgOidArray(value.getPgOidList(fieldIndex)); case BYTES: return Value.bytesArray(value.getBytesList(fieldIndex)); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java index 026b4ac5a24..9bf12160156 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java @@ -253,7 +253,13 @@ public static Collection parameters() { "getJson", Collections.singletonList("getValue") }, - {Type.pgOid(), "getPgOidInternal", 123L, "getPgOid", Collections.singletonList("getValue")}, + { + Type.pgOid(), + "getPgOidInternal", + 123L, + "getPgOid", + Collections.singletonList("getValue") + }, { Type.timestamp(), "getTimestampInternal", diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java index 23308c0419e..5fee6cfc346 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java @@ -3638,225 +3638,209 @@ public void testByteArray() { public void testGetAllTypesAsString() { for (Dialect dialect : Dialect.values()) { Statement statement = Statement.of("select * from all_types"); - ListValue.Builder dialectBasedBuilder = ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder().setBoolValue(true).build()) - .addValues( - com.google.protobuf.Value.newBuilder().setStringValue("100").build()) - .addValues( - com.google.protobuf.Value.newBuilder().setNumberValue(3.14d).build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("6.626") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("test-string") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("{\"key1\": \"value1\"}") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue( - Base64.getEncoder() - .encodeToString( - "test-bytes".getBytes(StandardCharsets.UTF_8))) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2023-01-11") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2023-01-11T11:55:18.123456789Z") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setBoolValue(true) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setBoolValue(false) - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue(String.valueOf(Long.MAX_VALUE)) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue(String.valueOf(Long.MIN_VALUE)) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNumberValue(-12345.6789d) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNumberValue(3.14d) - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("6.626") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("-8.9123") - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("test-string1") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("test-string2") - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("{\"key\": \"value1\"}") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("{\"key\": \"value2\"}") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue( - Base64.getEncoder() - .encodeToString( - "test-bytes1" - .getBytes( - StandardCharsets.UTF_8))) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue( - Base64.getEncoder() - .encodeToString( - "test-bytes2" - .getBytes( - StandardCharsets.UTF_8))) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2000-02-29") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2000-01-01") - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2023-01-11T11:55:18.123456789Z") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2023-01-12T11:55:18Z") - .build()) - .build())); + ListValue.Builder dialectBasedBuilder = + ListValue.newBuilder() + .addValues(com.google.protobuf.Value.newBuilder().setBoolValue(true).build()) + .addValues(com.google.protobuf.Value.newBuilder().setStringValue("100").build()) + .addValues(com.google.protobuf.Value.newBuilder().setNumberValue(3.14d).build()) + .addValues(com.google.protobuf.Value.newBuilder().setStringValue("6.626").build()) + .addValues( + com.google.protobuf.Value.newBuilder().setStringValue("test-string").build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("{\"key1\": \"value1\"}") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue( + Base64.getEncoder() + .encodeToString("test-bytes".getBytes(StandardCharsets.UTF_8))) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder().setStringValue("2023-01-11").build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("2023-01-11T11:55:18.123456789Z") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder().setBoolValue(true).build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setBoolValue(false) + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MAX_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MIN_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNumberValue(-12345.6789d) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNumberValue(3.14d) + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("6.626") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("-8.9123") + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("test-string1") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("test-string2") + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("{\"key\": \"value1\"}") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("{\"key\": \"value2\"}") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue( + Base64.getEncoder() + .encodeToString( + "test-bytes1".getBytes(StandardCharsets.UTF_8))) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue( + Base64.getEncoder() + .encodeToString( + "test-bytes2".getBytes(StandardCharsets.UTF_8))) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("2000-02-29") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("2000-01-01") + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("2023-01-11T11:55:18.123456789Z") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("2023-01-12T11:55:18Z") + .build()) + .build())); if (dialect == Dialect.POSTGRESQL) { - dialectBasedBuilder = dialectBasedBuilder - .addValues( - com.google.protobuf.Value.newBuilder().setStringValue("100").build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue(String.valueOf(Long.MAX_VALUE)) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue(String.valueOf(Long.MIN_VALUE)) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .build())); + dialectBasedBuilder = + dialectBasedBuilder + .addValues(com.google.protobuf.Value.newBuilder().setStringValue("100").build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MAX_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MIN_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .build())); } mockSpanner.putStatementResult( diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java index dc458a83262..c0a66652990 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java @@ -768,11 +768,11 @@ public void getPgJsonb() { @Test public void getPgOid() { consumer.onPartialResultSet( - PartialResultSet.newBuilder() - .setMetadata(makeMetadata(Type.struct(Type.StructField.of("f", Type.pgOid())))) - .addValues(Value.pgOid(Long.MIN_VALUE).toProto()) - .addValues(Value.pgOid(Long.MAX_VALUE).toProto()) - .build()); + PartialResultSet.newBuilder() + .setMetadata(makeMetadata(Type.struct(Type.StructField.of("f", Type.pgOid())))) + .addValues(Value.pgOid(Long.MIN_VALUE).toProto()) + .addValues(Value.pgOid(Long.MAX_VALUE).toProto()) + .build()); consumer.onCompleted(); assertThat(resultSet.next()).isTrue(); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MutationTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MutationTest.java index e14815c268d..cec9287b3a7 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MutationTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MutationTest.java @@ -618,7 +618,7 @@ private Mutation.WriteBuilder appendAllTypes(Mutation.WriteBuilder builder) { .set("pgOidArrNull") .toPgOidArray((long[]) null) .set("pgOidArrValue") - .to(Value.pgOidArray(ImmutableList.of(1L, 2L))) + .to(Value.pgOidArray(ImmutableList.of(1L, 2L))) .set("timestampArr") .toTimestampArray(ImmutableList.of(Timestamp.MAX_VALUE, Timestamp.MAX_VALUE)) .set("timestampArrNull") diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueBinderTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueBinderTest.java index 79e94f8e249..47167bbaeae 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueBinderTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueBinderTest.java @@ -18,8 +18,8 @@ import static com.google.cloud.spanner.ValueBinderTest.DefaultValues.defaultBytesBase64; import static com.google.cloud.spanner.ValueBinderTest.DefaultValues.defaultJson; -import static com.google.cloud.spanner.ValueBinderTest.DefaultValues.defaultPgJsonb; import static com.google.cloud.spanner.ValueBinderTest.DefaultValues.defaultLongWrapper; +import static com.google.cloud.spanner.ValueBinderTest.DefaultValues.defaultPgJsonb; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java index ef56cb4fbce..03330a71326 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java @@ -1929,10 +1929,10 @@ public void testEqualsHashCode() { tester.addEqualityGroup(Value.pgNumericArray(null), Value.pgNumericArray(null)); tester.addEqualityGroup( - Value.pgOidArray(Arrays.asList(1L, 2L)), - Value.pgOidArray(new long[] {1L, 2L}), - Value.pgOidArray(new long[] {0L, 1L, 2L, 3L}, 1, 2), - Value.pgOidArray(plainIterable(1L, 2L))); + Value.pgOidArray(Arrays.asList(1L, 2L)), + Value.pgOidArray(new long[] {1L, 2L}), + Value.pgOidArray(new long[] {0L, 1L, 2L, 3L}, 1, 2), + Value.pgOidArray(plainIterable(1L, 2L))); tester.addEqualityGroup(Value.pgOidArray(Collections.singletonList(3L))); tester.addEqualityGroup(Value.pgOidArray(Collections.singletonList(null))); tester.addEqualityGroup(Value.pgOidArray((Iterable) null)); @@ -2093,8 +2093,10 @@ public void serialization() { Value.pgNumericArray(BrokenSerializationList.of("1.23", "1.24", Value.NAN))); reserializeAndAssert(Value.pgNumericArray(null)); - reserializeAndAssert(Value.pgOidArray(BrokenSerializationList.of(Long.valueOf(1L), Long.valueOf(2L)))); - reserializeAndAssert(Value.pgOidArray(BrokenSerializationList.of(Long.valueOf(1L), Long.valueOf(2L), null))); + reserializeAndAssert( + Value.pgOidArray(BrokenSerializationList.of(Long.valueOf(1L), Long.valueOf(2L)))); + reserializeAndAssert( + Value.pgOidArray(BrokenSerializationList.of(Long.valueOf(1L), Long.valueOf(2L), null))); reserializeAndAssert(Value.pgOidArray((Iterable) null)); reserializeAndAssert(Value.timestamp(null)); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java index 77bad9d4360..f5eb90b8f36 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java @@ -44,85 +44,87 @@ public class RandomResultSetGenerator { public static Type[] generateAllTypes(Dialect dialect) { List allTypes = new ArrayList<>(); - allTypes.addAll(Arrays.asList( - Type.newBuilder().setCode(TypeCode.BOOL).build(), - Type.newBuilder().setCode(TypeCode.INT64).build(), - Type.newBuilder().setCode(TypeCode.FLOAT64).build(), - dialect == Dialect.POSTGRESQL - ? Type.newBuilder() - .setCode(TypeCode.NUMERIC) - .setTypeAnnotation(TypeAnnotationCode.PG_NUMERIC) - .build() - : Type.newBuilder().setCode(TypeCode.NUMERIC).build(), - Type.newBuilder().setCode(TypeCode.STRING).build(), - dialect == Dialect.POSTGRESQL - ? Type.newBuilder() - .setCode(TypeCode.JSON) - .setTypeAnnotation(TypeAnnotationCode.PG_JSONB) - .build() - : Type.newBuilder().setCode(TypeCode.JSON).build(), - Type.newBuilder().setCode(TypeCode.BYTES).build(), - Type.newBuilder().setCode(TypeCode.DATE).build(), - Type.newBuilder().setCode(TypeCode.TIMESTAMP).build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.BOOL)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.INT64)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.FLOAT64)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType( - dialect == Dialect.POSTGRESQL - ? Type.newBuilder() - .setCode(TypeCode.NUMERIC) - .setTypeAnnotation(TypeAnnotationCode.PG_NUMERIC) - : Type.newBuilder().setCode(TypeCode.NUMERIC)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.STRING)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType( - dialect == Dialect.POSTGRESQL - ? Type.newBuilder() - .setCode(TypeCode.JSON) - .setTypeAnnotation(TypeAnnotationCode.PG_JSONB) - : Type.newBuilder().setCode(TypeCode.JSON)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.BYTES)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.DATE)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.TIMESTAMP)) - .build())); + allTypes.addAll( + Arrays.asList( + Type.newBuilder().setCode(TypeCode.BOOL).build(), + Type.newBuilder().setCode(TypeCode.INT64).build(), + Type.newBuilder().setCode(TypeCode.FLOAT64).build(), + dialect == Dialect.POSTGRESQL + ? Type.newBuilder() + .setCode(TypeCode.NUMERIC) + .setTypeAnnotation(TypeAnnotationCode.PG_NUMERIC) + .build() + : Type.newBuilder().setCode(TypeCode.NUMERIC).build(), + Type.newBuilder().setCode(TypeCode.STRING).build(), + dialect == Dialect.POSTGRESQL + ? Type.newBuilder() + .setCode(TypeCode.JSON) + .setTypeAnnotation(TypeAnnotationCode.PG_JSONB) + .build() + : Type.newBuilder().setCode(TypeCode.JSON).build(), + Type.newBuilder().setCode(TypeCode.BYTES).build(), + Type.newBuilder().setCode(TypeCode.DATE).build(), + Type.newBuilder().setCode(TypeCode.TIMESTAMP).build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.BOOL)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.INT64)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.FLOAT64)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType( + dialect == Dialect.POSTGRESQL + ? Type.newBuilder() + .setCode(TypeCode.NUMERIC) + .setTypeAnnotation(TypeAnnotationCode.PG_NUMERIC) + : Type.newBuilder().setCode(TypeCode.NUMERIC)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.STRING)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType( + dialect == Dialect.POSTGRESQL + ? Type.newBuilder() + .setCode(TypeCode.JSON) + .setTypeAnnotation(TypeAnnotationCode.PG_JSONB) + : Type.newBuilder().setCode(TypeCode.JSON)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.BYTES)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.DATE)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.TIMESTAMP)) + .build())); if (dialect == Dialect.POSTGRESQL) { - allTypes.addAll(Arrays.asList( - Type.newBuilder() - .setCode(TypeCode.INT64) - .setTypeAnnotation(TypeAnnotationCode.PG_OID) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType( - Type.newBuilder() - .setCode(TypeCode.INT64) - .setTypeAnnotation(TypeAnnotationCode.PG_OID)) - .build())); + allTypes.addAll( + Arrays.asList( + Type.newBuilder() + .setCode(TypeCode.INT64) + .setTypeAnnotation(TypeAnnotationCode.PG_OID) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType( + Type.newBuilder() + .setCode(TypeCode.INT64) + .setTypeAnnotation(TypeAnnotationCode.PG_OID)) + .build())); } return allTypes.toArray(new Type[0]); } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java index 2d0bcfa5cd6..4603ec5b6c5 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java @@ -256,14 +256,18 @@ public void bindInt64Null() { @Test public void bindPgOid() { - Struct row = execute(Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(1234)), Type.pgOid()); + Struct row = + execute( + Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(1234)), Type.pgOid()); assertThat(row.isNull(0)).isFalse(); assertThat(row.getPgOid(0)).isEqualTo(1234); } @Test public void bindPgOidNull() { - Struct row = execute(Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(null)), Type.pgOid()); + Struct row = + execute( + Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(null)), Type.pgOid()); assertThat(row.isNull(0)).isTrue(); } From e5a39c5cb410ec24844efd46011579be27cd0d10 Mon Sep 17 00:00:00 2001 From: Quynh Tran Date: Mon, 18 Mar 2024 14:49:13 +1100 Subject: [PATCH 03/47] Update PG.OID implementation according to recent changes. --- .../com/google/cloud/spanner/GrpcStruct.java | 32 ++ .../cloud/spanner/DatabaseClientImplTest.java | 75 +-- .../connection/AllTypesMockServerTest.java | 462 ++++++++++-------- .../connection/ChecksumResultSetTest.java | 3 +- .../connection/RandomResultSetGenerator.java | 41 +- .../google/cloud/spanner/it/ITQueryTest.java | 18 +- 6 files changed, 371 insertions(+), 260 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStruct.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStruct.java index a6769acfadf..b939f315620 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStruct.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStruct.java @@ -29,6 +29,7 @@ import com.google.cloud.spanner.AbstractResultSet.Float64Array; import com.google.cloud.spanner.AbstractResultSet.Int64Array; import com.google.cloud.spanner.AbstractResultSet.LazyByteArray; +import com.google.cloud.spanner.AbstractResultSet.PgOidArray; import com.google.cloud.spanner.Type.Code; import com.google.cloud.spanner.Type.StructField; import com.google.common.base.Preconditions; @@ -114,6 +115,9 @@ private Object writeReplace() { case PG_JSONB: builder.set(fieldName).to(Value.pgJsonb((String) value)); break; + case PG_OID: + builder.set(fieldName).to(Value.pgOid((Long) value)); + break; case BYTES: builder .set(fieldName) @@ -158,6 +162,9 @@ private Object writeReplace() { case PG_JSONB: builder.set(fieldName).toPgJsonbArray((Iterable) value); break; + case PG_OID: + builder.set(fieldName).toPgOidArray((Iterable) value); + break; case BYTES: case PROTO: builder @@ -262,6 +269,7 @@ private static Object decodeValue(Type fieldType, com.google.protobuf.Value prot checkType(fieldType, proto, KindCase.BOOL_VALUE); return proto.getBoolValue(); case INT64: + case PG_OID: case ENUM: checkType(fieldType, proto, KindCase.STRING_VALUE); return Long.parseLong(proto.getStringValue()); @@ -339,6 +347,8 @@ static Object decodeArrayValue(Type elementType, ListValue listValue) { case STRUCT: case PROTO: return Lists.transform(listValue.getValuesList(), input -> decodeValue(elementType, input)); + case PG_OID: + return new PgOidArray(listValue); default: throw new AssertionError("Unhandled type code: " + elementType.getCode()); } @@ -460,6 +470,12 @@ protected String getPgJsonbInternal(int columnIndex) { return (String) rowData.get(columnIndex); } + @Override + protected long getPgOidInternal(int columnIndex) { + ensureDecoded(columnIndex); + return (Long) rowData.get(columnIndex); + } + @Override protected ByteArray getBytesInternal(int columnIndex) { ensureDecoded(columnIndex); @@ -563,6 +579,8 @@ protected Value getValueInternal(int columnIndex) { return Value.json(isNull ? null : getJsonInternal(columnIndex)); case PG_JSONB: return Value.pgJsonb(isNull ? null : getPgJsonbInternal(columnIndex)); + case PG_OID: + return Value.pgOid(isNull ? null : getPgOidInternal(columnIndex)); case BYTES: return Value.internalBytes(isNull ? null : getLazyBytesInternal(columnIndex)); case PROTO: @@ -598,6 +616,8 @@ protected Value getValueInternal(int columnIndex) { return Value.jsonArray(isNull ? null : getJsonListInternal(columnIndex)); case PG_JSONB: return Value.pgJsonbArray(isNull ? null : getPgJsonbListInternal(columnIndex)); + case PG_OID: + return Value.pgOidArray(isNull ? null : getPgOidListInternal(columnIndex)); case BYTES: return Value.bytesArray(isNull ? null : getBytesListInternal(columnIndex)); case PROTO: @@ -771,6 +791,18 @@ protected List getPgJsonbListInternal(int columnIndex) { return Collections.unmodifiableList((List) rowData.get(columnIndex)); } + @Override + protected PgOidArray getPgOidListInternal(int columnIndex) { + ensureDecoded(columnIndex); + return (PgOidArray) rowData.get(columnIndex); + } + + @Override + protected long[] getPgOidArrayInternal(int columnIndex) { + ensureDecoded(columnIndex); + return getPgOidListInternal(columnIndex).toPrimitiveArray(columnIndex); + } + @Override @SuppressWarnings("unchecked") // We know ARRAY produces a List. protected List getBytesListInternal(int columnIndex) { diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java index 16860f88a4d..f2997ec1611 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java @@ -4094,7 +4094,10 @@ public void testGetAllTypesAsString() { col++); assertAsString("2023-01-11", resultSet, col++); assertAsString("2023-01-11T11:55:18.123456789Z", resultSet, col++); - + if (dialect == Dialect.POSTGRESQL) { + // Check PG_OID value + assertAsString("100", resultSet, col++); + } assertAsString(ImmutableList.of("true", "NULL", "false"), resultSet, col++); assertAsString( ImmutableList.of( @@ -4135,16 +4138,6 @@ public void testGetAllTypesAsString() { ImmutableList.of("2023-01-11T11:55:18.123456789Z", "NULL", "2023-01-12T11:55:18Z"), resultSet, col++); - - if (dialect == Dialect.POSTGRESQL) { - assertAsString("100", resultSet, col++); - assertAsString( - ImmutableList.of( - String.format("%d", Long.MAX_VALUE), String.format("%d", Long.MIN_VALUE), "NULL"), - resultSet, - col++); - } - if (dialect == Dialect.GOOGLE_STANDARD_SQL) { assertAsString(Base64.getEncoder().encodeToString(info.toByteArray()), resultSet, col++); assertAsString(String.valueOf(Genre.JAZZ_VALUE), resultSet, col++); @@ -4157,6 +4150,14 @@ public void testGetAllTypesAsString() { assertAsString( ImmutableList.of(String.format("%d", Genre.JAZZ_VALUE), "NULL"), resultSet, col++); } + if (dialect == Dialect.POSTGRESQL) { + // Check ARRAY value + assertAsString( + ImmutableList.of( + String.format("%d", Long.MAX_VALUE), String.format("%d", Long.MIN_VALUE), "NULL"), + resultSet, + col++); + } assertFalse(resultSet.next()); } } @@ -4599,7 +4600,13 @@ private ListValue getRows(Dialect dialect) { .addValues( com.google.protobuf.Value.newBuilder() .setStringValue("2023-01-11T11:55:18.123456789Z") - .build()) + .build()); + if (dialect == Dialect.POSTGRESQL) { + // Add PG_OID value + valuesBuilder + .addValues(com.google.protobuf.Value.newBuilder().setStringValue("100").build()); + } + valuesBuilder .addValues( com.google.protobuf.Value.newBuilder() .setListValue( @@ -4781,28 +4788,6 @@ private ListValue getRows(Dialect dialect) { .build()) .build())); - if (dialect == Dialect.POSTGRESQL) { - valuesBuilder - .addValues(com.google.protobuf.Value.newBuilder().setStringValue("100").build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue(String.valueOf(Long.MAX_VALUE)) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue(String.valueOf(Long.MIN_VALUE)) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .build())); - } - if (dialect == Dialect.GOOGLE_STANDARD_SQL) { // Proto columns is supported only for GOOGLE_STANDARD_SQL valuesBuilder @@ -4842,6 +4827,28 @@ private ListValue getRows(Dialect dialect) { .build()) .build())); } + if (dialect == Dialect.POSTGRESQL) { + // Add ARRAY value + valuesBuilder + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MAX_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MIN_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .build())); + } + return valuesBuilder.build(); } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java index 44ae730f8c1..6ef739f9475 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java @@ -73,6 +73,7 @@ public static Object[] data() { public static final String PG_NUMERIC_VALUE = "3.14"; public static final String STRING_VALUE = "test-string"; public static final String JSON_VALUE = "{\"key1\":\"value1\", \"key2\":\"value2\"}"; + public static final long PG_OID_VALUE = 1L; public static final byte[] BYTES_VALUE = "test-bytes".getBytes(StandardCharsets.UTF_8); public static final Date DATE_VALUE = Date.fromYearMonthDay(2024, 3, 2); public static final Timestamp TIMESTAMP_VALUE = @@ -112,6 +113,8 @@ public static Object[] data() { "{\"key1\":\"value1.1\", \"key2\":\"value1.2\"}", null, "{\"key1\":\"value3.1\", \"key2\":\"value3.2\"}"); + public static final List PG_OID_ARRAY_VALUE = + Arrays.asList(100L, null, 200L, Long.MIN_VALUE, Long.MAX_VALUE); public static final List BYTES_ARRAY_VALUE = Arrays.asList(ByteArray.copyFrom("test-bytes1"), null, ByteArray.copyFrom("test-bytes2")); public static final List DATE_ARRAY_VALUE = @@ -155,12 +158,14 @@ private void setupAllTypesResultSet(Dialect dialect) { // COL8: BYTES // COL9: DATE // COL10: TIMESTAMP - // COL11-20: ARRAY<..> for the types above. + // COL11: PG_OID (added only for POSTGRESQL dialect) + // COL12-21: ARRAY<..> for the types above. // Only for GoogleSQL: - // COL21: PROTO - // COL22: ENUM - // COL23: ARRAY - // COL24: ARRAY + // COL22: PROTO + // COL23: ENUM + // COL24: ARRAY + // COL25: ARRAY + // COL26: ARRAY (added only for POSTGRESQL dialect) ListValue.Builder row1Builder = ListValue.newBuilder() .addValues(Value.newBuilder().setBoolValue(BOOL_VALUE)) @@ -178,193 +183,198 @@ private void setupAllTypesResultSet(Dialect dialect) { .addValues( Value.newBuilder().setStringValue(Base64.getEncoder().encodeToString(BYTES_VALUE))) .addValues(Value.newBuilder().setStringValue(DATE_VALUE.toString())) - .addValues(Value.newBuilder().setStringValue(TIMESTAMP_VALUE.toString())) - .addValues( - Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addAllValues( - BOOL_ARRAY_VALUE.stream() - .map( - b -> - b == null - ? Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build() - : Value.newBuilder().setBoolValue(b).build()) - .collect(Collectors.toList())) - .build())) - .addValues( - Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addAllValues( - INT64_ARRAY_VALUE.stream() - .map( - l -> - l == null - ? Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build() - : Value.newBuilder() - .setStringValue(String.valueOf(l)) - .build()) - .collect(Collectors.toList())) - .build())) - .addValues( - Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addAllValues( - FLOAT32_ARRAY_VALUE.stream() - .map( - f -> { - if (f == null) { - return Value.newBuilder() + .addValues(Value.newBuilder().setStringValue(TIMESTAMP_VALUE.toString())); + if (dialect == Dialect.POSTGRESQL) { + row1Builder.addValues(Value.newBuilder().setStringValue(String.valueOf(PG_OID_VALUE)).build()); + } + + row1Builder + .addValues( + Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addAllValues( + BOOL_ARRAY_VALUE.stream() + .map( + b -> + b == null + ? Value.newBuilder() .setNullValue(NullValue.NULL_VALUE) - .build(); - } else if (Float.isNaN(f)) { - return Value.newBuilder().setStringValue("NaN").build(); - } else { - return Value.newBuilder().setNumberValue(f).build(); - } - }) - .collect(Collectors.toList())) - .build())) - .addValues( - Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addAllValues( - FLOAT64_ARRAY_VALUE.stream() - .map( - d -> { - if (d == null) { - return Value.newBuilder() + .build() + : Value.newBuilder().setBoolValue(b).build()) + .collect(Collectors.toList())) + .build())) + .addValues( + Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addAllValues( + INT64_ARRAY_VALUE.stream() + .map( + l -> + l == null + ? Value.newBuilder() .setNullValue(NullValue.NULL_VALUE) - .build(); - } else if (Double.isNaN(d)) { - return Value.newBuilder().setStringValue("NaN").build(); - } else { - return Value.newBuilder().setNumberValue(d).build(); - } - }) - .collect(Collectors.toList())) - .build())) - .addValues( - Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addAllValues( - dialect == Dialect.POSTGRESQL - ? PG_NUMERIC_ARRAY_VALUE.stream() - .map( - string -> - string == null - ? Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build() - : Value.newBuilder() - .setStringValue(string) - .build()) - .collect(Collectors.toList()) - : NUMERIC_ARRAY_VALUE.stream() - .map( - bigDecimal -> - bigDecimal == null - ? Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build() - : Value.newBuilder() - .setStringValue( - bigDecimal.toEngineeringString()) - .build()) - .collect(Collectors.toList())) - .build())) - .addValues( - Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addAllValues( - STRING_ARRAY_VALUE.stream() + .build() + : Value.newBuilder() + .setStringValue(String.valueOf(l)) + .build()) + .collect(Collectors.toList())) + .build())) + .addValues( + Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addAllValues( + FLOAT32_ARRAY_VALUE.stream() + .map( + f -> { + if (f == null) { + return Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build(); + } else if (Float.isNaN(f)) { + return Value.newBuilder().setStringValue("NaN").build(); + } else { + return Value.newBuilder().setNumberValue(f).build(); + } + }) + .collect(Collectors.toList())) + .build())) + .addValues( + Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addAllValues( + FLOAT64_ARRAY_VALUE.stream() + .map( + d -> { + if (d == null) { + return Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build(); + } else if (Double.isNaN(d)) { + return Value.newBuilder().setStringValue("NaN").build(); + } else { + return Value.newBuilder().setNumberValue(d).build(); + } + }) + .collect(Collectors.toList())) + .build())) + .addValues( + Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addAllValues( + dialect == Dialect.POSTGRESQL + ? PG_NUMERIC_ARRAY_VALUE.stream() .map( string -> string == null - ? Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build() - : Value.newBuilder().setStringValue(string).build()) - .collect(Collectors.toList())) - .build())) - .addValues( - Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addAllValues( - JSON_ARRAY_VALUE.stream() - .map( - json -> - json == null - ? Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build() - : Value.newBuilder().setStringValue(json).build()) - .collect(Collectors.toList())) - .build())) - .addValues( - Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addAllValues( - BYTES_ARRAY_VALUE.stream() - .map( - byteArray -> - byteArray == null - ? Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build() - : Value.newBuilder() - .setStringValue( - Base64.getEncoder() - .encodeToString( - byteArray.toByteArray())) - .build()) - .collect(Collectors.toList())) - .build())) - .addValues( - Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addAllValues( - DATE_ARRAY_VALUE.stream() - .map( - date -> - date == null ? Value.newBuilder() .setNullValue(NullValue.NULL_VALUE) .build() : Value.newBuilder() - .setStringValue(date.toString()) + .setStringValue(string) .build()) - .collect(Collectors.toList())) - .build())) - .addValues( - Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addAllValues( - TIMESTAMP_ARRAY_VALUE.stream() + .collect(Collectors.toList()) + : NUMERIC_ARRAY_VALUE.stream() .map( - timestamp -> - timestamp == null + bigDecimal -> + bigDecimal == null ? Value.newBuilder() .setNullValue(NullValue.NULL_VALUE) .build() : Value.newBuilder() - .setStringValue(timestamp.toString()) + .setStringValue( + bigDecimal.toEngineeringString()) .build()) .collect(Collectors.toList())) - .build())); + .build())) + .addValues( + Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addAllValues( + STRING_ARRAY_VALUE.stream() + .map( + string -> + string == null + ? Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build() + : Value.newBuilder().setStringValue(string).build()) + .collect(Collectors.toList())) + .build())) + .addValues( + Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addAllValues( + JSON_ARRAY_VALUE.stream() + .map( + json -> + json == null + ? Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build() + : Value.newBuilder().setStringValue(json).build()) + .collect(Collectors.toList())) + .build())) + .addValues( + Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addAllValues( + BYTES_ARRAY_VALUE.stream() + .map( + byteArray -> + byteArray == null + ? Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build() + : Value.newBuilder() + .setStringValue( + Base64.getEncoder() + .encodeToString( + byteArray.toByteArray())) + .build()) + .collect(Collectors.toList())) + .build())) + .addValues( + Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addAllValues( + DATE_ARRAY_VALUE.stream() + .map( + date -> + date == null + ? Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build() + : Value.newBuilder() + .setStringValue(date.toString()) + .build()) + .collect(Collectors.toList())) + .build())) + .addValues( + Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addAllValues( + TIMESTAMP_ARRAY_VALUE.stream() + .map( + timestamp -> + timestamp == null + ? Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build() + : Value.newBuilder() + .setStringValue(timestamp.toString()) + .build()) + .collect(Collectors.toList())) + .build())); if (dialect == Dialect.GOOGLE_STANDARD_SQL) { // Add PROTO values. @@ -433,6 +443,28 @@ private void setupAllTypesResultSet(Dialect dialect) { .build()); } + if (dialect == Dialect.POSTGRESQL) { + // Add ARRAY values. + row1Builder + .addValues( + Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addAllValues( + PG_OID_ARRAY_VALUE.stream() + .map( + l -> + l == null + ? Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build() + : Value.newBuilder() + .setStringValue(String.valueOf(l)) + .build()) + .collect(Collectors.toList())) + .build())); + } + com.google.spanner.v1.ResultSet resultSet = com.google.spanner.v1.ResultSet.newBuilder() .setMetadata( @@ -454,7 +486,7 @@ public static Statement createInsertStatement(Dialect dialect) { .mapToObj(col -> "@p" + col) .collect(Collectors.joining(", ", "", ")"))); int param = 0; - return builder + builder .bind("p" + ++param) .to(BOOL_VALUE) .bind("p" + ++param) @@ -480,7 +512,13 @@ public static Statement createInsertStatement(Dialect dialect) { .bind("p" + ++param) .to(DATE_VALUE) .bind("p" + ++param) - .to(TIMESTAMP_VALUE) + .to(TIMESTAMP_VALUE); + if (dialect == Dialect.POSTGRESQL) { + builder + .bind("p" + ++param) + .to(PG_OID_VALUE); + } + builder .bind("p" + ++param) .toBoolArray(BOOL_ARRAY_VALUE) .bind("p" + ++param) @@ -506,8 +544,13 @@ public static Statement createInsertStatement(Dialect dialect) { .bind("p" + ++param) .toDateArray(DATE_ARRAY_VALUE) .bind("p" + ++param) - .toTimestampArray(TIMESTAMP_ARRAY_VALUE) - .build(); + .toTimestampArray(TIMESTAMP_ARRAY_VALUE); + if (dialect == Dialect.POSTGRESQL) { + builder + .bind("p" + ++param) + .toInt64Array(PG_OID_ARRAY_VALUE); + } + return builder.build(); } @After @@ -538,6 +581,9 @@ public void testSelectAllTypes() { assertArrayEquals(BYTES_VALUE, resultSet.getBytes(++col).toByteArray()); assertEquals(DATE_VALUE, resultSet.getDate(++col)); assertEquals(TIMESTAMP_VALUE, resultSet.getTimestamp(++col)); + if (dialect == Dialect.POSTGRESQL) { + assertEquals(PG_OID_VALUE, resultSet.getPgOid(++col)); + } assertEquals(BOOL_ARRAY_VALUE, resultSet.getBooleanList(++col)); assertEquals(INT64_ARRAY_VALUE, resultSet.getLongList(++col)); @@ -557,7 +603,9 @@ public void testSelectAllTypes() { assertEquals(BYTES_ARRAY_VALUE, resultSet.getBytesList(++col)); assertEquals(DATE_ARRAY_VALUE, resultSet.getDateList(++col)); assertEquals(TIMESTAMP_ARRAY_VALUE, resultSet.getTimestampList(++col)); - + if (dialect == Dialect.POSTGRESQL) { + assertEquals(PG_OID_ARRAY_VALUE, resultSet.getPgOidList(++col)); + } assertFalse(resultSet.next()); } } @@ -572,22 +620,38 @@ public void testInsertAllTypes() { ExecuteSqlRequest request = mockSpanner.getRequestsOfType(ExecuteSqlRequest.class).get(0); Map paramTypes = request.getParamTypesMap(); Map params = request.getParams().getFieldsMap(); - assertEquals(20, paramTypes.size()); - assertEquals(20, params.size()); + System.out.println("Dialect = " + dialect); + assertEquals(dialect == Dialect.POSTGRESQL ? 22 : 20, paramTypes.size()); + assertEquals(dialect == Dialect.POSTGRESQL ? 22 : 20, params.size()); // Verify param types. - ImmutableList expectedTypes = - ImmutableList.of( - TypeCode.BOOL, - TypeCode.INT64, - TypeCode.FLOAT32, - TypeCode.FLOAT64, - TypeCode.NUMERIC, - TypeCode.STRING, - TypeCode.JSON, - TypeCode.BYTES, - TypeCode.DATE, - TypeCode.TIMESTAMP); + ImmutableList expectedTypes; + if (dialect == Dialect.POSTGRESQL) { + expectedTypes = ImmutableList.of( + TypeCode.BOOL, + TypeCode.INT64, + TypeCode.FLOAT32, + TypeCode.FLOAT64, + TypeCode.NUMERIC, + TypeCode.STRING, + TypeCode.JSON, + TypeCode.BYTES, + TypeCode.DATE, + TypeCode.TIMESTAMP, + TypeCode.INT64); + } else { + expectedTypes = ImmutableList.of( + TypeCode.BOOL, + TypeCode.INT64, + TypeCode.FLOAT32, + TypeCode.FLOAT64, + TypeCode.NUMERIC, + TypeCode.STRING, + TypeCode.JSON, + TypeCode.BYTES, + TypeCode.DATE, + TypeCode.TIMESTAMP); + } for (int col = 0; col < expectedTypes.size(); col++) { assertEquals(expectedTypes.get(col), paramTypes.get("p" + (col + 1)).getCode()); int arrayCol = col + expectedTypes.size(); @@ -613,6 +677,9 @@ public void testInsertAllTypes() { params.get("p" + ++col).getStringValue()); assertEquals(DATE_VALUE.toString(), params.get("p" + ++col).getStringValue()); assertEquals(TIMESTAMP_VALUE.toString(), params.get("p" + ++col).getStringValue()); + if (dialect == Dialect.POSTGRESQL) { + assertEquals(String.valueOf(PG_OID_VALUE), params.get("p" + ++col).getStringValue()); + } assertEquals( BOOL_ARRAY_VALUE, @@ -678,6 +745,13 @@ public void testInsertAllTypes() { ? null : Timestamp.parseTimestamp(value.getStringValue())) .collect(Collectors.toList())); + if (dialect == Dialect.POSTGRESQL) { + assertEquals( + PG_OID_ARRAY_VALUE, + params.get("p" + ++col).getListValue().getValuesList().stream() + .map(value -> value.hasNullValue() ? null : Long.valueOf(value.getStringValue())) + .collect(Collectors.toList())); + } } } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ChecksumResultSetTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ChecksumResultSetTest.java index 330ee9a1513..e13cfa91c1f 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ChecksumResultSetTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ChecksumResultSetTest.java @@ -162,8 +162,7 @@ public void testRetry() { Type.StructField.of("stringArray", Type.array(Type.string())), Type.StructField.of("jsonArray", Type.array(Type.json())), Type.StructField.of("pgJsonbArray", Type.array(Type.pgJsonb())), - Type.StructField.of("pgOidArray", Type.array(Type.pgOid()))); - Type.StructField.of("pgJsonbArray", Type.array(Type.pgJsonb())), + Type.StructField.of("pgOidArray", Type.array(Type.pgOid())), Type.StructField.of( "protoMessageArray", Type.array(Type.proto(SingerInfo.getDescriptor().getFullName()))), diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java index e914fdbcf66..4066b9e681a 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java @@ -68,7 +68,15 @@ public static Type[] generateAllTypes(Dialect dialect) { : Type.newBuilder().setCode(TypeCode.JSON).build(), Type.newBuilder().setCode(TypeCode.BYTES).build(), Type.newBuilder().setCode(TypeCode.DATE).build(), - Type.newBuilder().setCode(TypeCode.TIMESTAMP).build(), + Type.newBuilder().setCode(TypeCode.TIMESTAMP).build())); + if (dialect == Dialect.POSTGRESQL) { + types.add( + Type.newBuilder() + .setCode(TypeCode.INT64) + .setTypeAnnotation(TypeAnnotationCode.PG_OID) + .build()); + } + types.addAll(Arrays.asList( Type.newBuilder() .setCode(TypeCode.ARRAY) .setArrayElementType(Type.newBuilder().setCode(TypeCode.BOOL)) @@ -121,7 +129,17 @@ public static Type[] generateAllTypes(Dialect dialect) { .build())); appendProtoTypes(types, dialect); - appendOidType(types, dialect); + + if (dialect == Dialect.POSTGRESQL) { + types.add( + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType( + Type.newBuilder() + .setCode(TypeCode.INT64) + .setTypeAnnotation(TypeAnnotationCode.PG_OID)) + .build()); + } Type[] typeArray = new Type[types.size()]; typeArray = types.toArray(typeArray); @@ -160,25 +178,6 @@ private static void appendProtoTypes(List types, Dialect dialect) { } } - /** To append OID type **/ - private static void appendOidType(List types, Dialect dialect) { - if (dialect == Dialect.POSTGRESQL) { - types.add( - Type.newBuilder() - .setCode(TypeCode.INT64) - .setTypeAnnotation(TypeAnnotationCode.PG_OID) - .build()); - types.add( - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType( - Type.newBuilder() - .setCode(TypeCode.INT64) - .setTypeAnnotation(TypeAnnotationCode.PG_OID)) - .build()); - } - } - public static ResultSetMetadata generateAllTypesMetadata(Type[] types) { StructType.Builder rowTypeBuilder = StructType.newBuilder(); for (int col = 0; col < types.length; col++) { diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java index dd05a739028..6344d2e2c1f 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java @@ -287,19 +287,19 @@ public void bindFloat32Null() { @Test public void bindPgOid() { - Struct row = - execute( - Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(1234)), Type.pgOid()); - assertThat(row.isNull(0)).isFalse(); - assertThat(row.getPgOid(0)).isEqualTo(1234); + if (dialect.dialect == Dialect.POSTGRESQL) { + Struct row = execute(Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(1234)), Type.pgOid()); + assertThat(row.isNull(0)).isFalse(); + assertThat(row.getPgOid(0)).isEqualTo(1234); + } } @Test public void bindPgOidNull() { - Struct row = - execute( - Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(null)), Type.pgOid()); - assertThat(row.isNull(0)).isTrue(); + if (dialect.dialect == Dialect.POSTGRESQL) { + Struct row = execute(Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(null)), Type.pgOid()); + assertThat(row.isNull(0)).isTrue(); + } } @Test From 537de96b1e5740d8e716d6b45308e65bfa799ca1 Mon Sep 17 00:00:00 2001 From: Quynh Tran Date: Mon, 18 Mar 2024 14:49:13 +1100 Subject: [PATCH 04/47] Update PG.OID implementation according to recent changes. --- .../cloud/spanner/DatabaseClientImplTest.java | 392 +++++++++--------- .../connection/AllTypesMockServerTest.java | 59 ++- .../connection/RandomResultSetGenerator.java | 105 ++--- .../google/cloud/spanner/it/ITQueryTest.java | 10 +- 4 files changed, 279 insertions(+), 287 deletions(-) diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java index f2997ec1611..24fa402d41f 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java @@ -4154,7 +4154,7 @@ public void testGetAllTypesAsString() { // Check ARRAY value assertAsString( ImmutableList.of( - String.format("%d", Long.MAX_VALUE), String.format("%d", Long.MIN_VALUE), "NULL"), + String.format("%d", Long.MAX_VALUE), String.format("%d", Long.MIN_VALUE), "NULL"), resultSet, col++); } @@ -4603,190 +4603,181 @@ private ListValue getRows(Dialect dialect) { .build()); if (dialect == Dialect.POSTGRESQL) { // Add PG_OID value - valuesBuilder - .addValues(com.google.protobuf.Value.newBuilder().setStringValue("100").build()); + valuesBuilder.addValues(com.google.protobuf.Value.newBuilder().setStringValue("100").build()); } valuesBuilder - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder().setBoolValue(true).build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder().setBoolValue(false).build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue(String.valueOf(Long.MAX_VALUE)) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue(String.valueOf(Long.MIN_VALUE)) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNumberValue(Float.MAX_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNumberValue(Float.MIN_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("NaN") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNumberValue(3.14f) - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNumberValue(-12345.6789d) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNumberValue(3.14d) - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("6.626") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("-8.9123") - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("test-string1") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("test-string2") - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("{\"key\": \"value1\"}") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("{\"key\": \"value2\"}") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue( - Base64.getEncoder() - .encodeToString( - "test-bytes1".getBytes(StandardCharsets.UTF_8))) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue( - Base64.getEncoder() - .encodeToString( - "test-bytes2".getBytes(StandardCharsets.UTF_8))) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2000-02-29") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2000-01-01") - .build()) - .build())) - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2023-01-11T11:55:18.123456789Z") - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue("2023-01-12T11:55:18Z") - .build()) - .build())); + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder().setBoolValue(true).build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder().setBoolValue(false).build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MAX_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MIN_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNumberValue(Float.MAX_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNumberValue(Float.MIN_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder().setStringValue("NaN").build()) + .addValues( + com.google.protobuf.Value.newBuilder().setNumberValue(3.14f).build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNumberValue(-12345.6789d) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder().setNumberValue(3.14d).build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder().setStringValue("6.626").build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("-8.9123") + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("test-string1") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("test-string2") + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("{\"key\": \"value1\"}") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("{\"key\": \"value2\"}") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue( + Base64.getEncoder() + .encodeToString( + "test-bytes1".getBytes(StandardCharsets.UTF_8))) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue( + Base64.getEncoder() + .encodeToString( + "test-bytes2".getBytes(StandardCharsets.UTF_8))) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("2000-02-29") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("2000-01-01") + .build()) + .build())) + .addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("2023-01-11T11:55:18.123456789Z") + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue("2023-01-12T11:55:18Z") + .build()) + .build())); if (dialect == Dialect.GOOGLE_STANDARD_SQL) { // Proto columns is supported only for GOOGLE_STANDARD_SQL @@ -4829,24 +4820,23 @@ private ListValue getRows(Dialect dialect) { } if (dialect == Dialect.POSTGRESQL) { // Add ARRAY value - valuesBuilder - .addValues( - com.google.protobuf.Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue(String.valueOf(Long.MAX_VALUE)) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setStringValue(String.valueOf(Long.MIN_VALUE)) - .build()) - .addValues( - com.google.protobuf.Value.newBuilder() - .setNullValue(NullValue.NULL_VALUE) - .build()) - .build())); + valuesBuilder.addValues( + com.google.protobuf.Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MAX_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setStringValue(String.valueOf(Long.MIN_VALUE)) + .build()) + .addValues( + com.google.protobuf.Value.newBuilder() + .setNullValue(NullValue.NULL_VALUE) + .build()) + .build())); } return valuesBuilder.build(); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java index 6ef739f9475..80eaceff439 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java @@ -185,7 +185,8 @@ private void setupAllTypesResultSet(Dialect dialect) { .addValues(Value.newBuilder().setStringValue(DATE_VALUE.toString())) .addValues(Value.newBuilder().setStringValue(TIMESTAMP_VALUE.toString())); if (dialect == Dialect.POSTGRESQL) { - row1Builder.addValues(Value.newBuilder().setStringValue(String.valueOf(PG_OID_VALUE)).build()); + row1Builder.addValues( + Value.newBuilder().setStringValue(String.valueOf(PG_OID_VALUE)).build()); } row1Builder @@ -274,9 +275,7 @@ private void setupAllTypesResultSet(Dialect dialect) { ? Value.newBuilder() .setNullValue(NullValue.NULL_VALUE) .build() - : Value.newBuilder() - .setStringValue(string) - .build()) + : Value.newBuilder().setStringValue(string).build()) .collect(Collectors.toList()) : NUMERIC_ARRAY_VALUE.stream() .map( @@ -336,8 +335,7 @@ private void setupAllTypesResultSet(Dialect dialect) { : Value.newBuilder() .setStringValue( Base64.getEncoder() - .encodeToString( - byteArray.toByteArray())) + .encodeToString(byteArray.toByteArray())) .build()) .collect(Collectors.toList())) .build())) @@ -445,24 +443,23 @@ private void setupAllTypesResultSet(Dialect dialect) { if (dialect == Dialect.POSTGRESQL) { // Add ARRAY values. - row1Builder - .addValues( - Value.newBuilder() - .setListValue( - ListValue.newBuilder() - .addAllValues( - PG_OID_ARRAY_VALUE.stream() - .map( - l -> - l == null - ? Value.newBuilder() + row1Builder.addValues( + Value.newBuilder() + .setListValue( + ListValue.newBuilder() + .addAllValues( + PG_OID_ARRAY_VALUE.stream() + .map( + l -> + l == null + ? Value.newBuilder() .setNullValue(NullValue.NULL_VALUE) .build() - : Value.newBuilder() + : Value.newBuilder() .setStringValue(String.valueOf(l)) .build()) - .collect(Collectors.toList())) - .build())); + .collect(Collectors.toList())) + .build())); } com.google.spanner.v1.ResultSet resultSet = @@ -514,9 +511,7 @@ public static Statement createInsertStatement(Dialect dialect) { .bind("p" + ++param) .to(TIMESTAMP_VALUE); if (dialect == Dialect.POSTGRESQL) { - builder - .bind("p" + ++param) - .to(PG_OID_VALUE); + builder.bind("p" + ++param).to(PG_OID_VALUE); } builder .bind("p" + ++param) @@ -546,9 +541,7 @@ public static Statement createInsertStatement(Dialect dialect) { .bind("p" + ++param) .toTimestampArray(TIMESTAMP_ARRAY_VALUE); if (dialect == Dialect.POSTGRESQL) { - builder - .bind("p" + ++param) - .toInt64Array(PG_OID_ARRAY_VALUE); + builder.bind("p" + ++param).toInt64Array(PG_OID_ARRAY_VALUE); } return builder.build(); } @@ -627,7 +620,8 @@ public void testInsertAllTypes() { // Verify param types. ImmutableList expectedTypes; if (dialect == Dialect.POSTGRESQL) { - expectedTypes = ImmutableList.of( + expectedTypes = + ImmutableList.of( TypeCode.BOOL, TypeCode.INT64, TypeCode.FLOAT32, @@ -640,7 +634,8 @@ public void testInsertAllTypes() { TypeCode.TIMESTAMP, TypeCode.INT64); } else { - expectedTypes = ImmutableList.of( + expectedTypes = + ImmutableList.of( TypeCode.BOOL, TypeCode.INT64, TypeCode.FLOAT32, @@ -747,10 +742,10 @@ public void testInsertAllTypes() { .collect(Collectors.toList())); if (dialect == Dialect.POSTGRESQL) { assertEquals( - PG_OID_ARRAY_VALUE, - params.get("p" + ++col).getListValue().getValuesList().stream() - .map(value -> value.hasNullValue() ? null : Long.valueOf(value.getStringValue())) - .collect(Collectors.toList())); + PG_OID_ARRAY_VALUE, + params.get("p" + ++col).getListValue().getValuesList().stream() + .map(value -> value.hasNullValue() ? null : Long.valueOf(value.getStringValue())) + .collect(Collectors.toList())); } } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java index 4066b9e681a..da4b87200c3 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java @@ -76,57 +76,58 @@ public static Type[] generateAllTypes(Dialect dialect) { .setTypeAnnotation(TypeAnnotationCode.PG_OID) .build()); } - types.addAll(Arrays.asList( - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.BOOL)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.INT64)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.FLOAT32)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.FLOAT64)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType( - dialect == Dialect.POSTGRESQL - ? Type.newBuilder() - .setCode(TypeCode.NUMERIC) - .setTypeAnnotation(TypeAnnotationCode.PG_NUMERIC) - : Type.newBuilder().setCode(TypeCode.NUMERIC)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.STRING)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType( - dialect == Dialect.POSTGRESQL - ? Type.newBuilder() - .setCode(TypeCode.JSON) - .setTypeAnnotation(TypeAnnotationCode.PG_JSONB) - : Type.newBuilder().setCode(TypeCode.JSON)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.BYTES)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.DATE)) - .build(), - Type.newBuilder() - .setCode(TypeCode.ARRAY) - .setArrayElementType(Type.newBuilder().setCode(TypeCode.TIMESTAMP)) - .build())); + types.addAll( + Arrays.asList( + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.BOOL)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.INT64)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.FLOAT32)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.FLOAT64)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType( + dialect == Dialect.POSTGRESQL + ? Type.newBuilder() + .setCode(TypeCode.NUMERIC) + .setTypeAnnotation(TypeAnnotationCode.PG_NUMERIC) + : Type.newBuilder().setCode(TypeCode.NUMERIC)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.STRING)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType( + dialect == Dialect.POSTGRESQL + ? Type.newBuilder() + .setCode(TypeCode.JSON) + .setTypeAnnotation(TypeAnnotationCode.PG_JSONB) + : Type.newBuilder().setCode(TypeCode.JSON)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.BYTES)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.DATE)) + .build(), + Type.newBuilder() + .setCode(TypeCode.ARRAY) + .setArrayElementType(Type.newBuilder().setCode(TypeCode.TIMESTAMP)) + .build())); appendProtoTypes(types, dialect); @@ -146,7 +147,7 @@ public static Type[] generateAllTypes(Dialect dialect) { return typeArray; } - /** To append Proto & Enum types **/ + /** To append Proto & Enum types * */ private static void appendProtoTypes(List types, Dialect dialect) { if (dialect == Dialect.GOOGLE_STANDARD_SQL) { types.add( diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java index 6344d2e2c1f..9260dcb7c7a 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java @@ -288,7 +288,10 @@ public void bindFloat32Null() { @Test public void bindPgOid() { if (dialect.dialect == Dialect.POSTGRESQL) { - Struct row = execute(Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(1234)), Type.pgOid()); + Struct row = + execute( + Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(1234)), + Type.pgOid()); assertThat(row.isNull(0)).isFalse(); assertThat(row.getPgOid(0)).isEqualTo(1234); } @@ -297,7 +300,10 @@ public void bindPgOid() { @Test public void bindPgOidNull() { if (dialect.dialect == Dialect.POSTGRESQL) { - Struct row = execute(Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(null)), Type.pgOid()); + Struct row = + execute( + Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(null)), + Type.pgOid()); assertThat(row.isNull(0)).isTrue(); } } From f9ea807141a19c817413cb80e97c833ed2dcc55c Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 22 Mar 2024 04:32:34 +0000 Subject: [PATCH 05/47] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4718890c54f..b8fd2f3be7c 100644 --- a/README.md +++ b/README.md @@ -57,13 +57,13 @@ implementation 'com.google.cloud:google-cloud-spanner' If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-spanner:6.61.0' +implementation 'com.google.cloud:google-cloud-spanner:6.62.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.61.0" +libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.62.0" ``` @@ -650,7 +650,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-spanner/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-spanner.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.61.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.62.0 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles From 4cb354acdcebfa0735023cd34f732a78df70392a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Fri, 15 Mar 2024 07:56:38 +0100 Subject: [PATCH 06/47] chore: keep session pool ordering when pinging (#2695) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: keep session pool ordering when pinging Pinging sessions would move the sessions that were pinged to either the front or the back of the pool (dependingin the session pool configuration), instead of keeping the sessions in the place where they were when being pinged. Bringing a session that is pinged to the front of the pool means that we will prefer using a session that has not really been used for a while, other than for the ping. Keeping the sessions in place is therefore preferable. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../com/google/cloud/spanner/SessionPool.java | 38 +++++++++++++------ .../spanner/SessionPoolMaintainerTest.java | 29 +++++++++----- 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java index cc24dd2ba0f..3e01112366c 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java @@ -49,6 +49,7 @@ import com.google.api.gax.core.ExecutorProvider; import com.google.api.gax.rpc.ServerStream; import com.google.cloud.Timestamp; +import com.google.cloud.Tuple; import com.google.cloud.grpc.GrpcTransportOptions; import com.google.cloud.grpc.GrpcTransportOptions.ExecutorFactory; import com.google.cloud.spanner.Options.QueryOption; @@ -1854,7 +1855,7 @@ private void keepAliveSessions(Instant currTime) { // Keep chugging till there is no session that needs to be kept alive. while (numSessionsToKeepAlive > 0) { - PooledSession sessionToKeepAlive = null; + Tuple sessionToKeepAlive; synchronized (lock) { sessionToKeepAlive = findSessionToKeepAlive(sessions, keepAliveThreshold, 0); } @@ -1862,10 +1863,10 @@ private void keepAliveSessions(Instant currTime) { break; } try { - logger.log(Level.FINE, "Keeping alive session " + sessionToKeepAlive.getName()); + logger.log(Level.FINE, "Keeping alive session " + sessionToKeepAlive.x().getName()); numSessionsToKeepAlive--; - sessionToKeepAlive.keepAlive(); - releaseSession(sessionToKeepAlive, false); + sessionToKeepAlive.x().keepAlive(); + releaseSession(sessionToKeepAlive); } catch (SpannerException e) { handleException(e, sessionToKeepAlive); } @@ -2314,11 +2315,11 @@ private boolean isClosed() { } } - private void handleException(SpannerException e, PooledSession session) { + private void handleException(SpannerException e, Tuple session) { if (isSessionNotFound(e)) { - invalidateSession(session); + invalidateSession(session.x()); } else { - releaseSession(session, false); + releaseSession(session); } } @@ -2342,7 +2343,7 @@ private void invalidateSession(PooledSession session) { } } - private PooledSession findSessionToKeepAlive( + private Tuple findSessionToKeepAlive( Queue queue, Instant keepAliveThreshold, int numAlreadyChecked) { int numChecked = 0; Iterator iterator = queue.iterator(); @@ -2352,7 +2353,7 @@ private PooledSession findSessionToKeepAlive( PooledSession session = iterator.next(); if (session.delegate.getLastUseTime().isBefore(keepAliveThreshold)) { iterator.remove(); - return session; + return Tuple.of(session, numChecked); } numChecked++; } @@ -2476,8 +2477,17 @@ private void maybeCreateSession() { } } - /** Releases a session back to the pool. This might cause one of the waiters to be unblocked. */ + private void releaseSession(Tuple sessionWithPosition) { + releaseSession(sessionWithPosition.x(), false, sessionWithPosition.y()); + } + private void releaseSession(PooledSession session, boolean isNewSession) { + releaseSession(session, isNewSession, null); + } + + /** Releases a session back to the pool. This might cause one of the waiters to be unblocked. */ + private void releaseSession( + PooledSession session, boolean isNewSession, @Nullable Integer position) { Preconditions.checkNotNull(session); synchronized (lock) { if (closureFuture != null) { @@ -2497,7 +2507,12 @@ private void releaseSession(PooledSession session, boolean isNewSession) { // more efficient. session.releaseToPosition = options.getReleaseToPosition(); } - if (session.releaseToPosition == Position.RANDOM && !sessions.isEmpty()) { + if (position != null) { + // Make sure we use a valid position, as the number of sessions could have changed in the + // meantime. + int actualPosition = Math.min(position, sessions.size()); + sessions.add(actualPosition, session); + } else if (session.releaseToPosition == Position.RANDOM && !sessions.isEmpty()) { // A session should only be added at a random position the first time it is added to // the pool or if the pool was deemed unbalanced. All following releases into the pool // should normally happen at the default release position (unless the pool is again deemed @@ -2510,6 +2525,7 @@ private void releaseSession(PooledSession session, boolean isNewSession) { } else { sessions.addFirst(session); } + session.releaseToPosition = options.getReleaseToPosition(); } else { waiters.poll().put(session); } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolMaintainerTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolMaintainerTest.java index 127ffd3bff6..f629c0fc1d6 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolMaintainerTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolMaintainerTest.java @@ -17,6 +17,7 @@ package com.google.cloud.spanner; import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; @@ -175,14 +176,20 @@ public void testKeepAlive() throws Exception { Session session3 = pool.getSession(); Session session4 = pool.getSession(); Session session5 = pool.getSession(); - // Note that session2 was now the first session in the pool as it was the last to receive a - // ping. - assertThat(session3.getName()).isEqualTo(session2.getName()); - assertThat(session4.getName()).isEqualTo(session1.getName()); + // Pinging a session will put it at the back of the pool. A session that needed a ping to be + // kept alive is not one that should be preferred for use. This means that session2 is the last + // session in the pool, and session1 the second-to-last. + assertEquals(session1.getName(), session3.getName()); + assertEquals(session2.getName(), session4.getName()); session5.close(); session4.close(); session3.close(); // Advance the clock to force pings for the sessions in the pool and do three maintenance loops. + // This should ping the sessions in the following order: + // 1. session3 (=session1) + // 2. session4 (=session2) + // The pinged sessions already contains: {session1: 1, session2: 1} + // Note that the pool only pings up to MinSessions sessions. clock.currentTimeMillis.addAndGet( TimeUnit.MINUTES.toMillis(options.getKeepAliveIntervalMinutes()) + 1); runMaintenanceLoop(clock, pool, 3); @@ -192,16 +199,18 @@ public void testKeepAlive() throws Exception { // should cause only one session to get a ping. clock.currentTimeMillis.addAndGet( TimeUnit.MINUTES.toMillis(options.getKeepAliveIntervalMinutes()) + 1); - // We are now checking out session2 because + // This will be session1, as all sessions were pinged in the previous 3 maintenance loops, and + // this will have brought session1 back to the front of the pool. Session session6 = pool.getSession(); // The session that was first in the pool now is equal to the initial first session as each full // round of pings will swap the order of the first MinSessions sessions in the pool. assertThat(session6.getName()).isEqualTo(session1.getName()); runMaintenanceLoop(clock, pool, 3); + // Running 3 cycles will only ping the 2 sessions in the pool once. assertThat(pool.totalSessions()).isEqualTo(3); assertThat(pingedSessions).containsExactly(session1.getName(), 2, session2.getName(), 3); // Update the last use date and release the session to the pool and do another maintenance - // cycle. + // cycle. This should not ping any sessions. ((PooledSessionFuture) session6).get().markUsed(); session6.close(); runMaintenanceLoop(clock, pool, 3); @@ -267,10 +276,10 @@ public void testIdleSessions() throws Exception { Session session3 = pool.getSession().get(); Session session4 = pool.getSession().get(); Session session5 = pool.getSession().get(); - // Note that session2 was now the first session in the pool as it was the last to receive a - // ping. - assertThat(session3.getName()).isEqualTo(session2.getName()); - assertThat(session4.getName()).isEqualTo(session1.getName()); + // Note that pinging sessions does not change the order of the pool. This means that session2 + // is still the last session in the pool. + assertThat(session3.getName()).isEqualTo(session1.getName()); + assertThat(session4.getName()).isEqualTo(session2.getName()); session5.close(); session4.close(); session3.close(); From e505b9e6f53bef654b777c5d6281cd29f047f25d Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Mon, 18 Mar 2024 05:29:52 +0100 Subject: [PATCH 07/47] deps: update dependency com.google.cloud:google-cloud-monitoring to v3.38.0 (#2942) --- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index b2cb8158cbe..143fe8d00bc 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -24,7 +24,7 @@ UTF-8 0.31.1 2.37.0 - 3.37.0 + 3.38.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 7da8cb97068..6f0de936485 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -24,7 +24,7 @@ UTF-8 0.31.1 2.37.0 - 3.37.0 + 3.38.0 From 01845549c5950c5872f3a9c495c4027f648eadd4 Mon Sep 17 00:00:00 2001 From: Hailong Wen Date: Mon, 18 Mar 2024 22:24:17 -0700 Subject: [PATCH 08/47] feat: allow attempt direct path xds via env var (#2950) To enable Direct Access, [both `setAttemptDirectPath` and `setAttemptDirectPathXds` should be called](https://togithub.com/googleapis/sdk-platform-java/blob/4b44a7851dc1d4fd2ac21a54df6c24db5625223c/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java#L373-L386) for gax to append the correct google-c2p scheme. This PR adds a env var `GOOGLE_SPANNER_ENABLE_DIRECT_ACCESS` to control the enable/disable of Direct Access. When it is true, it calls `setAttemptDirectPathXds` which effectively turns on Direct Access (as `options.isAttemptDirectPath` is by default true and we don't need to call `setAttemptDirectPath` again). --- .../com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java index 0f4b2275717..29de1fe1ff5 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java @@ -354,6 +354,11 @@ public GapicSpannerRpc(final SpannerOptions options) { options.isAttemptDirectPath() && !Objects.equals( options.getScopedCredentials(), NoCredentials.getInstance())); + String directPathXdsEnv = System.getenv("GOOGLE_SPANNER_ENABLE_DIRECT_ACCESS"); + boolean isAttemptDirectPathXds = Boolean.parseBoolean(directPathXdsEnv); + if (isAttemptDirectPathXds) { + defaultChannelProviderBuilder.setAttemptDirectPathXds(); + } if (options.isUseVirtualThreads()) { ExecutorService executor = tryCreateVirtualThreadPerTaskExecutor("spanner-virtual-grpc-executor"); From 1d756a3f0093aad2a753e03598fb7ff3caacc653 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 19 Mar 2024 08:23:15 +0100 Subject: [PATCH 09/47] build(deps): update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.13.0 (#2956) --- google-cloud-spanner-bom/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index e60c1748158..34500f6aac5 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -100,7 +100,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.12.1 + 3.13.0 1.8 1.8 diff --git a/pom.xml b/pom.xml index 9884574355d..92877606631 100644 --- a/pom.xml +++ b/pom.xml @@ -153,7 +153,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.12.1 + 3.13.0 1.8 1.8 From f6193f9bf018b17f01b4e773b7f521a20e21ba4c Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 19 Mar 2024 08:23:38 +0100 Subject: [PATCH 10/47] build(deps): update dependency org.apache.maven.plugins:maven-assembly-plugin to v3.7.1 (#2955) --- google-cloud-spanner-executor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud-spanner-executor/pom.xml b/google-cloud-spanner-executor/pom.xml index f44522494bb..3aa9033e44a 100644 --- a/google-cloud-spanner-executor/pom.xml +++ b/google-cloud-spanner-executor/pom.xml @@ -164,7 +164,7 @@ maven-assembly-plugin - 3.7.0 + 3.7.1 assembly-descriptor.xml From aed12230702f466817a3f56f83006ee094ee21e9 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 19 Mar 2024 08:24:15 +0100 Subject: [PATCH 11/47] deps: update dependency com.google.cloud:sdk-platform-java-config to v3.28.1 (#2952) --- .kokoro/presubmit/graalvm-native-17.cfg | 2 +- .kokoro/presubmit/graalvm-native.cfg | 2 +- google-cloud-spanner-bom/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg index 56db68092d2..c2a88196e84 100644 --- a/.kokoro/presubmit/graalvm-native-17.cfg +++ b/.kokoro/presubmit/graalvm-native-17.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.27.0" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.28.1" } env_vars: { diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg index 6283184778e..94e00cbaa0a 100644 --- a/.kokoro/presubmit/graalvm-native.cfg +++ b/.kokoro/presubmit/graalvm-native.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.27.0" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.28.1" } env_vars: { diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index 34500f6aac5..6749cc4c36f 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -8,7 +8,7 @@ com.google.cloud sdk-platform-java-config - 3.27.0 + 3.28.1 Google Cloud Spanner BOM diff --git a/pom.xml b/pom.xml index 92877606631..57cccfdc43e 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ com.google.cloud sdk-platform-java-config - 3.27.0 + 3.28.1 From bf2361beb1b672d0bf6fafece28d35d24337424c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Tue, 19 Mar 2024 09:16:27 +0100 Subject: [PATCH 12/47] refactor: move skip methods to abstract parser (#2948) Move the PostgreSQL skip methods from the PostgreSQL parser to the abstract parser. This is step 1 in refactoring the GoogleSQL and PostgreSQL parser so they can share more code. The eventual goal is to allow the GoogleSQL parser to be able to handle SQL string without having to remove the comments from the string first. --- .../connection/AbstractStatementParser.java | 166 ++++++++++++++++++ .../connection/PostgreSQLStatementParser.java | 147 ---------------- 2 files changed, 166 insertions(+), 147 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java index 8fc3043791e..ac984a0f864 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java @@ -40,6 +40,7 @@ import java.util.concurrent.Callable; import java.util.logging.Level; import java.util.logging.Logger; +import javax.annotation.Nullable; /** * Internal class for the Spanner Connection API. @@ -696,4 +697,169 @@ static int countOccurrencesOf(char c, String string) { public boolean checkReturningClause(String sql) { return checkReturningClauseInternal(sql); } + + /** + * Returns true for characters that can be used as the first character in unquoted identifiers. + */ + boolean isValidIdentifierFirstChar(char c) { + return Character.isLetter(c) || c == UNDERSCORE; + } + + /** Returns true for characters that can be used in unquoted identifiers. */ + boolean isValidIdentifierChar(char c) { + return isValidIdentifierFirstChar(c) || Character.isDigit(c) || c == DOLLAR; + } + + /** Reads a dollar-quoted string literal from position index in the given sql string. */ + String parseDollarQuotedString(String sql, int index) { + // Look ahead to the next dollar sign (if any). Everything in between is the quote tag. + StringBuilder tag = new StringBuilder(); + while (index < sql.length()) { + char c = sql.charAt(index); + if (c == DOLLAR) { + return tag.toString(); + } + if (!isValidIdentifierChar(c)) { + break; + } + tag.append(c); + index++; + } + return null; + } + + /** + * Skips the next character, literal, identifier, or comment in the given sql string from the + * given index. The skipped characters are added to result if it is not null. + */ + int skip(String sql, int currentIndex, @Nullable StringBuilder result) { + char currentChar = sql.charAt(currentIndex); + if (currentChar == SINGLE_QUOTE || currentChar == DOUBLE_QUOTE) { + appendIfNotNull(result, currentChar); + return skipQuoted(sql, currentIndex, currentChar, result); + } else if (currentChar == DOLLAR) { + String dollarTag = parseDollarQuotedString(sql, currentIndex + 1); + if (dollarTag != null) { + appendIfNotNull(result, currentChar, dollarTag, currentChar); + return skipQuoted( + sql, currentIndex + dollarTag.length() + 1, currentChar, dollarTag, result); + } + } else if (currentChar == HYPHEN + && sql.length() > (currentIndex + 1) + && sql.charAt(currentIndex + 1) == HYPHEN) { + return skipSingleLineComment(sql, currentIndex, result); + } else if (currentChar == SLASH + && sql.length() > (currentIndex + 1) + && sql.charAt(currentIndex + 1) == ASTERISK) { + return skipMultiLineComment(sql, currentIndex, result); + } + + appendIfNotNull(result, currentChar); + return currentIndex + 1; + } + + /** Skips a single-line comment from startIndex and adds it to result if result is not null. */ + static int skipSingleLineComment(String sql, int startIndex, @Nullable StringBuilder result) { + int endIndex = sql.indexOf('\n', startIndex + 2); + if (endIndex == -1) { + endIndex = sql.length(); + } else { + // Include the newline character. + endIndex++; + } + appendIfNotNull(result, sql.substring(startIndex, endIndex)); + return endIndex; + } + + /** Skips a multi-line comment from startIndex and adds it to result if result is not null. */ + static int skipMultiLineComment(String sql, int startIndex, @Nullable StringBuilder result) { + // Current position is start + '/*'.length(). + int pos = startIndex + 2; + // PostgreSQL allows comments to be nested. That is, the following is allowed: + // '/* test /* inner comment */ still a comment */' + int level = 1; + while (pos < sql.length()) { + if (sql.charAt(pos) == SLASH && sql.length() > (pos + 1) && sql.charAt(pos + 1) == ASTERISK) { + level++; + } + if (sql.charAt(pos) == ASTERISK && sql.length() > (pos + 1) && sql.charAt(pos + 1) == SLASH) { + level--; + if (level == 0) { + pos += 2; + appendIfNotNull(result, sql.substring(startIndex, pos)); + return pos; + } + } + pos++; + } + appendIfNotNull(result, sql.substring(startIndex)); + return sql.length(); + } + + /** Skips a quoted string from startIndex. */ + private int skipQuoted( + String sql, int startIndex, char startQuote, @Nullable StringBuilder result) { + return skipQuoted(sql, startIndex, startQuote, null, result); + } + + /** + * Skips a quoted string from startIndex. The quote character is assumed to be $ if dollarTag is + * not null. + */ + private int skipQuoted( + String sql, + int startIndex, + char startQuote, + String dollarTag, + @Nullable StringBuilder result) { + int currentIndex = startIndex + 1; + while (currentIndex < sql.length()) { + char currentChar = sql.charAt(currentIndex); + if (currentChar == startQuote) { + if (currentChar == DOLLAR) { + // Check if this is the end of the current dollar quoted string. + String tag = parseDollarQuotedString(sql, currentIndex + 1); + if (tag != null && tag.equals(dollarTag)) { + appendIfNotNull(result, currentChar, dollarTag, currentChar); + return currentIndex + tag.length() + 2; + } + } else if (sql.length() > currentIndex + 1 && sql.charAt(currentIndex + 1) == startQuote) { + // This is an escaped quote (e.g. 'foo''bar') + appendIfNotNull(result, currentChar); + appendIfNotNull(result, currentChar); + currentIndex += 2; + continue; + } else { + appendIfNotNull(result, currentChar); + return currentIndex + 1; + } + } + currentIndex++; + appendIfNotNull(result, currentChar); + } + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.INVALID_ARGUMENT, "SQL statement contains an unclosed literal: " + sql); + } + + /** Appends the given character to result if result is not null. */ + private void appendIfNotNull(@Nullable StringBuilder result, char currentChar) { + if (result != null) { + result.append(currentChar); + } + } + + /** Appends the given suffix to result if result is not null. */ + private static void appendIfNotNull(@Nullable StringBuilder result, String suffix) { + if (result != null) { + result.append(suffix); + } + } + + /** Appends the given prefix, tag, and suffix to result if result is not null. */ + private static void appendIfNotNull( + @Nullable StringBuilder result, char prefix, String tag, char suffix) { + if (result != null) { + result.append(prefix).append(tag).append(suffix); + } + } } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/PostgreSQLStatementParser.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/PostgreSQLStatementParser.java index 8cb2b7e464a..572ea056546 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/PostgreSQLStatementParser.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/PostgreSQLStatementParser.java @@ -26,7 +26,6 @@ import java.util.HashSet; import java.util.Set; import java.util.regex.Pattern; -import javax.annotation.Nullable; @InternalApi public class PostgreSQLStatementParser extends AbstractStatementParser { @@ -136,23 +135,6 @@ String removeCommentsAndTrimInternal(String sql) { return res.toString().trim(); } - String parseDollarQuotedString(String sql, int index) { - // Look ahead to the next dollar sign (if any). Everything in between is the quote tag. - StringBuilder tag = new StringBuilder(); - while (index < sql.length()) { - char c = sql.charAt(index); - if (c == DOLLAR) { - return tag.toString(); - } - if (!isValidIdentifierChar(c)) { - break; - } - tag.append(c); - index++; - } - return null; - } - /** PostgreSQL does not support statement hints. */ @Override String removeStatementHint(String sql) { @@ -220,135 +202,6 @@ public Set getQueryParameters(String sql) { return parameters; } - private int skip(String sql, int currentIndex, @Nullable StringBuilder result) { - char currentChar = sql.charAt(currentIndex); - if (currentChar == SINGLE_QUOTE || currentChar == DOUBLE_QUOTE) { - appendIfNotNull(result, currentChar); - return skipQuoted(sql, currentIndex, currentChar, result); - } else if (currentChar == DOLLAR) { - String dollarTag = parseDollarQuotedString(sql, currentIndex + 1); - if (dollarTag != null) { - appendIfNotNull(result, currentChar, dollarTag, currentChar); - return skipQuoted( - sql, currentIndex + dollarTag.length() + 1, currentChar, dollarTag, result); - } - } else if (currentChar == HYPHEN - && sql.length() > (currentIndex + 1) - && sql.charAt(currentIndex + 1) == HYPHEN) { - return skipSingleLineComment(sql, currentIndex, result); - } else if (currentChar == SLASH - && sql.length() > (currentIndex + 1) - && sql.charAt(currentIndex + 1) == ASTERISK) { - return skipMultiLineComment(sql, currentIndex, result); - } - - appendIfNotNull(result, currentChar); - return currentIndex + 1; - } - - static int skipSingleLineComment(String sql, int currentIndex, @Nullable StringBuilder result) { - int endIndex = sql.indexOf('\n', currentIndex + 2); - if (endIndex == -1) { - endIndex = sql.length(); - } else { - // Include the newline character. - endIndex++; - } - appendIfNotNull(result, sql.substring(currentIndex, endIndex)); - return endIndex; - } - - static int skipMultiLineComment(String sql, int startIndex, @Nullable StringBuilder result) { - // Current position is start + '/*'.length(). - int pos = startIndex + 2; - // PostgreSQL allows comments to be nested. That is, the following is allowed: - // '/* test /* inner comment */ still a comment */' - int level = 1; - while (pos < sql.length()) { - if (sql.charAt(pos) == SLASH && sql.length() > (pos + 1) && sql.charAt(pos + 1) == ASTERISK) { - level++; - } - if (sql.charAt(pos) == ASTERISK && sql.length() > (pos + 1) && sql.charAt(pos + 1) == SLASH) { - level--; - if (level == 0) { - pos += 2; - appendIfNotNull(result, sql.substring(startIndex, pos)); - return pos; - } - } - pos++; - } - appendIfNotNull(result, sql.substring(startIndex)); - return sql.length(); - } - - private int skipQuoted( - String sql, int startIndex, char startQuote, @Nullable StringBuilder result) { - return skipQuoted(sql, startIndex, startQuote, null, result); - } - - private int skipQuoted( - String sql, - int startIndex, - char startQuote, - String dollarTag, - @Nullable StringBuilder result) { - int currentIndex = startIndex + 1; - while (currentIndex < sql.length()) { - char currentChar = sql.charAt(currentIndex); - if (currentChar == startQuote) { - if (currentChar == DOLLAR) { - // Check if this is the end of the current dollar quoted string. - String tag = parseDollarQuotedString(sql, currentIndex + 1); - if (tag != null && tag.equals(dollarTag)) { - appendIfNotNull(result, currentChar, dollarTag, currentChar); - return currentIndex + tag.length() + 2; - } - } else if (sql.length() > currentIndex + 1 && sql.charAt(currentIndex + 1) == startQuote) { - // This is an escaped quote (e.g. 'foo''bar') - appendIfNotNull(result, currentChar); - appendIfNotNull(result, currentChar); - currentIndex += 2; - continue; - } else { - appendIfNotNull(result, currentChar); - return currentIndex + 1; - } - } - currentIndex++; - appendIfNotNull(result, currentChar); - } - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.INVALID_ARGUMENT, "SQL statement contains an unclosed literal: " + sql); - } - - private void appendIfNotNull(@Nullable StringBuilder result, char currentChar) { - if (result != null) { - result.append(currentChar); - } - } - - private static void appendIfNotNull(@Nullable StringBuilder result, String suffix) { - if (result != null) { - result.append(suffix); - } - } - - private void appendIfNotNull( - @Nullable StringBuilder result, char prefix, String tag, char suffix) { - if (result != null) { - result.append(prefix).append(tag).append(suffix); - } - } - - private boolean isValidIdentifierFirstChar(char c) { - return Character.isLetter(c) || c == UNDERSCORE; - } - - private boolean isValidIdentifierChar(char c) { - return isValidIdentifierFirstChar(c) || Character.isDigit(c) || c == DOLLAR; - } - private boolean checkCharPrecedingReturning(char ch) { return (ch == SPACE) || (ch == SINGLE_QUOTE) From 57edce9ae2189eafeacb1320b6d3ae9950be04e9 Mon Sep 17 00:00:00 2001 From: Arpan Mishra Date: Tue, 19 Mar 2024 13:58:17 +0530 Subject: [PATCH 13/47] fix: return type of max commit delay option. (#2953) * Use `TransactionOption` as return type instead of `TransactionOption` --- google-cloud-spanner/clirr-ignored-differences.xml | 8 ++++++++ .../src/main/java/com/google/cloud/spanner/Options.java | 5 ++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/google-cloud-spanner/clirr-ignored-differences.xml b/google-cloud-spanner/clirr-ignored-differences.xml index b556b27e2a2..3abdcab49b3 100644 --- a/google-cloud-spanner/clirr-ignored-differences.xml +++ b/google-cloud-spanner/clirr-ignored-differences.xml @@ -662,6 +662,14 @@ com.google.cloud.spanner.admin.instance.v1.stub.InstanceAdminStubSettings getInstanceAdminStubSettings() + + + 7006 + com/google/cloud/spanner/Options + com.google.cloud.spanner.Options$ReadQueryUpdateTransactionOption maxCommitDelay(java.time.Duration) + com.google.cloud.spanner.Options$TransactionOption + + 7005 com/google/cloud/spanner/PartitionedDmlTransaction diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Options.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Options.java index 76d0f24225a..d5c95d0a5a5 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Options.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Options.java @@ -141,7 +141,7 @@ public static ReadQueryUpdateTransactionOption priority(RpcPriority priority) { return new PriorityOption(priority); } - public static ReadQueryUpdateTransactionOption maxCommitDelay(Duration maxCommitDelay) { + public static TransactionOption maxCommitDelay(Duration maxCommitDelay) { Preconditions.checkArgument(!maxCommitDelay.isNegative(), "maxCommitDelay should be positive"); return new MaxCommitDelayOption(maxCommitDelay); } @@ -258,8 +258,7 @@ void appendToOptions(Options options) { static final CommitStatsOption COMMIT_STATS_OPTION = new CommitStatsOption(); /** Option to request {@link MaxCommitDelayOption} for read/write transactions. */ - static final class MaxCommitDelayOption extends InternalOption - implements ReadQueryUpdateTransactionOption { + static final class MaxCommitDelayOption extends InternalOption implements TransactionOption { final Duration maxCommitDelay; MaxCommitDelayOption(Duration maxCommitDelay) { From d7ba42b743286e3b2acf86f05c1bd52fdd9ad32d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Tue, 19 Mar 2024 09:56:16 +0100 Subject: [PATCH 14/47] refactor: generalize skip methods (#2949) Generalize the various skip methods so these can be used for both dialects. Each dialect implements a number of abstract methods to indicate what type of statements and constructs they support. These methods are used by the generalized skip methods to determine the start and end of literals, identifiers, and comments. This is step 2 of the refactor that is needed to share more of the code between the SpannerStatementParser and PostgreSQLStatementParser. --- .../connection/AbstractStatementParser.java | 120 ++++++++++++++++-- .../connection/PostgreSQLStatementParser.java | 40 ++++++ .../connection/SpannerStatementParser.java | 40 ++++++ .../SpannerStatementParserTest.java | 83 ++++++++++++ .../connection/StatementParserTest.java | 4 +- 5 files changed, 276 insertions(+), 11 deletions(-) create mode 100644 google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/SpannerStatementParserTest.java diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java index ac984a0f864..13301181452 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java @@ -595,6 +595,7 @@ private boolean statementStartsWith(String sql, Iterable checkStatements static final char CLOSE_PARENTHESIS = ')'; static final char COMMA = ','; static final char UNDERSCORE = '_'; + static final char BACKSLASH = '\\'; /** * Removes comments from and trims the given sql statement using the dialect of this parser. @@ -698,6 +699,62 @@ public boolean checkReturningClause(String sql) { return checkReturningClauseInternal(sql); } + /** + * <<<<<<< HEAD Returns true if this dialect supports nested comments. + * + *
    + *
  • This method should return false for dialects that consider this to be a valid comment: + * /* A comment /* still a comment */. + *
  • This method should return true for dialects that require all comment start sequences to + * be balanced with a comment end sequence: + * /* A comment /* still a comment */ Also still a comment */. + *
+ */ + abstract boolean supportsNestedComments(); + + /** + * Returns true for dialects that support dollar-quoted string literals. + * + *

Example: $tag$This is a string$tag$. + */ + abstract boolean supportsDollarQuotedStrings(); + + /** + * Returns true for dialects that support backticks as a quoting character, either for string + * literals or identifiers. + */ + abstract boolean supportsBacktickQuote(); + + /** + * Returns true for dialects that support triple-quoted string literals and identifiers. + * + *

Example: ```This is a triple-quoted string``` + */ + abstract boolean supportsTripleQuotedStrings(); + + /** + * Returns true if the dialect supports escaping a quote character within a literal with the same + * quote as the literal is using. That is: 'foo''bar' means "foo'bar". + */ + abstract boolean supportsEscapeQuoteWithQuote(); + + /** Returns true if the dialect supports starting an escape sequence with a backslash. */ + abstract boolean supportsBackslashEscape(); + + /** + * Returns true if the dialect supports single-line comments that start with a dash. + * + *

Example: # This is a comment + */ + abstract boolean supportsHashSingleLineComments(); + + /** + * Returns true for dialects that allow line-feeds in quoted strings. Note that the return value + * of this is not used for triple-quoted strings. Triple-quoted strings are assumed to always + * support line-feeds. + */ + abstract boolean supportsLineFeedInQuotedString(); + /** * Returns true for characters that can be used as the first character in unquoted identifiers. */ @@ -733,11 +790,17 @@ String parseDollarQuotedString(String sql, int index) { * given index. The skipped characters are added to result if it is not null. */ int skip(String sql, int currentIndex, @Nullable StringBuilder result) { + if (currentIndex >= sql.length()) { + return currentIndex; + } char currentChar = sql.charAt(currentIndex); - if (currentChar == SINGLE_QUOTE || currentChar == DOUBLE_QUOTE) { + + if (currentChar == SINGLE_QUOTE + || currentChar == DOUBLE_QUOTE + || (supportsBacktickQuote() && currentChar == BACKTICK_QUOTE)) { appendIfNotNull(result, currentChar); return skipQuoted(sql, currentIndex, currentChar, result); - } else if (currentChar == DOLLAR) { + } else if (supportsDollarQuotedStrings() && currentChar == DOLLAR) { String dollarTag = parseDollarQuotedString(sql, currentIndex + 1); if (dollarTag != null) { appendIfNotNull(result, currentChar, dollarTag, currentChar); @@ -748,6 +811,8 @@ int skip(String sql, int currentIndex, @Nullable StringBuilder result) { && sql.length() > (currentIndex + 1) && sql.charAt(currentIndex + 1) == HYPHEN) { return skipSingleLineComment(sql, currentIndex, result); + } else if (currentChar == DASH && supportsHashSingleLineComments()) { + return skipSingleLineComment(sql, currentIndex, result); } else if (currentChar == SLASH && sql.length() > (currentIndex + 1) && sql.charAt(currentIndex + 1) == ASTERISK) { @@ -772,14 +837,17 @@ static int skipSingleLineComment(String sql, int startIndex, @Nullable StringBui } /** Skips a multi-line comment from startIndex and adds it to result if result is not null. */ - static int skipMultiLineComment(String sql, int startIndex, @Nullable StringBuilder result) { + int skipMultiLineComment(String sql, int startIndex, @Nullable StringBuilder result) { // Current position is start + '/*'.length(). int pos = startIndex + 2; // PostgreSQL allows comments to be nested. That is, the following is allowed: // '/* test /* inner comment */ still a comment */' int level = 1; while (pos < sql.length()) { - if (sql.charAt(pos) == SLASH && sql.length() > (pos + 1) && sql.charAt(pos + 1) == ASTERISK) { + if (supportsNestedComments() + && sql.charAt(pos) == SLASH + && sql.length() > (pos + 1) + && sql.charAt(pos + 1) == ASTERISK) { level++; } if (sql.charAt(pos) == ASTERISK && sql.length() > (pos + 1) && sql.charAt(pos + 1) == SLASH) { @@ -806,33 +874,67 @@ private int skipQuoted( * Skips a quoted string from startIndex. The quote character is assumed to be $ if dollarTag is * not null. */ - private int skipQuoted( + int skipQuoted( String sql, int startIndex, char startQuote, - String dollarTag, + @Nullable String dollarTag, @Nullable StringBuilder result) { - int currentIndex = startIndex + 1; + boolean isTripleQuoted = + supportsTripleQuotedStrings() + && sql.length() > startIndex + 2 + && sql.charAt(startIndex + 1) == startQuote + && sql.charAt(startIndex + 2) == startQuote; + int currentIndex = startIndex + (isTripleQuoted ? 3 : 1); + if (isTripleQuoted) { + appendIfNotNull(result, startQuote); + appendIfNotNull(result, startQuote); + } while (currentIndex < sql.length()) { char currentChar = sql.charAt(currentIndex); if (currentChar == startQuote) { - if (currentChar == DOLLAR) { + if (supportsDollarQuotedStrings() && currentChar == DOLLAR) { // Check if this is the end of the current dollar quoted string. String tag = parseDollarQuotedString(sql, currentIndex + 1); if (tag != null && tag.equals(dollarTag)) { appendIfNotNull(result, currentChar, dollarTag, currentChar); return currentIndex + tag.length() + 2; } - } else if (sql.length() > currentIndex + 1 && sql.charAt(currentIndex + 1) == startQuote) { + } else if (supportsEscapeQuoteWithQuote() + && sql.length() > currentIndex + 1 + && sql.charAt(currentIndex + 1) == startQuote) { // This is an escaped quote (e.g. 'foo''bar') appendIfNotNull(result, currentChar); appendIfNotNull(result, currentChar); currentIndex += 2; continue; + } else if (isTripleQuoted) { + // Check if this is the end of the triple-quoted string. + if (sql.length() > currentIndex + 2 + && sql.charAt(currentIndex + 1) == startQuote + && sql.charAt(currentIndex + 2) == startQuote) { + appendIfNotNull(result, currentChar); + appendIfNotNull(result, currentChar); + appendIfNotNull(result, currentChar); + return currentIndex + 3; + } } else { appendIfNotNull(result, currentChar); return currentIndex + 1; } + } else if (supportsBackslashEscape() + && currentChar == BACKSLASH + && sql.length() > currentIndex + 1 + && sql.charAt(currentIndex + 1) == startQuote) { + // This is an escaped quote (e.g. 'foo\'bar'). + // Note that in raw strings, the \ officially does not start an escape sequence, but the + // result is still the same, as in a raw string 'both characters are preserved'. + appendIfNotNull(result, currentChar); + appendIfNotNull(result, sql.charAt(currentIndex + 1)); + currentIndex += 2; + continue; + } else if (currentChar == '\n' && !isTripleQuoted && !supportsLineFeedInQuotedString()) { + break; } currentIndex++; appendIfNotNull(result, currentChar); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/PostgreSQLStatementParser.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/PostgreSQLStatementParser.java index 572ea056546..6b0c69d40a9 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/PostgreSQLStatementParser.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/PostgreSQLStatementParser.java @@ -48,6 +48,46 @@ protected boolean supportsExplain() { return false; } + @Override + boolean supportsNestedComments() { + return true; + } + + @Override + boolean supportsDollarQuotedStrings() { + return true; + } + + @Override + boolean supportsBacktickQuote() { + return false; + } + + @Override + boolean supportsTripleQuotedStrings() { + return false; + } + + @Override + boolean supportsEscapeQuoteWithQuote() { + return true; + } + + @Override + boolean supportsBackslashEscape() { + return false; + } + + @Override + boolean supportsHashSingleLineComments() { + return false; + } + + @Override + boolean supportsLineFeedInQuotedString() { + return true; + } + /** * Removes comments from and trims the given sql statement. PostgreSQL supports two types of * comments: diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SpannerStatementParser.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SpannerStatementParser.java index 251c5a2e6ec..1c5cdda7b01 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SpannerStatementParser.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SpannerStatementParser.java @@ -50,6 +50,46 @@ protected boolean supportsExplain() { return true; } + @Override + boolean supportsNestedComments() { + return false; + } + + @Override + boolean supportsDollarQuotedStrings() { + return false; + } + + @Override + boolean supportsBacktickQuote() { + return true; + } + + @Override + boolean supportsTripleQuotedStrings() { + return true; + } + + @Override + boolean supportsEscapeQuoteWithQuote() { + return false; + } + + @Override + boolean supportsBackslashEscape() { + return true; + } + + @Override + boolean supportsHashSingleLineComments() { + return true; + } + + @Override + boolean supportsLineFeedInQuotedString() { + return false; + } + /** * Removes comments from and trims the given sql statement. Spanner supports three types of * comments: diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/SpannerStatementParserTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/SpannerStatementParserTest.java new file mode 100644 index 00000000000..d4dc76d48bb --- /dev/null +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/SpannerStatementParserTest.java @@ -0,0 +1,83 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner.connection; + +import static org.junit.Assert.assertEquals; + +import com.google.cloud.spanner.Dialect; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class SpannerStatementParserTest { + + static String skip(String sql) { + return skip(sql, 0); + } + + static String skip(String sql, int currentIndex) { + int position = + AbstractStatementParser.getInstance(Dialect.GOOGLE_STANDARD_SQL) + .skip(sql, currentIndex, null); + return sql.substring(currentIndex, position); + } + + @Test + public void testSkip() { + assertEquals("", skip("")); + assertEquals("1", skip("1 ")); + assertEquals("1", skip("12 ")); + assertEquals("2", skip("12 ", 1)); + assertEquals("", skip("12", 2)); + + assertEquals("'foo'", skip("'foo' ", 0)); + assertEquals("'foo'", skip("'foo''bar' ", 0)); + assertEquals("'foo'", skip("'foo' 'bar' ", 0)); + assertEquals("'bar'", skip("'foo''bar' ", 5)); + assertEquals("'foo\"bar\"'", skip("'foo\"bar\"' ", 0)); + assertEquals("\"foo'bar'\"", skip("\"foo'bar'\" ", 0)); + assertEquals("`foo'bar'`", skip("`foo'bar'` ", 0)); + + assertEquals("'''foo'bar'''", skip("'''foo'bar''' ", 0)); + assertEquals("'''foo\\'bar'''", skip("'''foo\\'bar''' ", 0)); + assertEquals("'''foo\\'\\'bar'''", skip("'''foo\\'\\'bar''' ", 0)); + assertEquals("'''foo\\'\\'\\'bar'''", skip("'''foo\\'\\'\\'bar''' ", 0)); + assertEquals("\"\"\"foo'bar\"\"\"", skip("\"\"\"foo'bar\"\"\"", 0)); + assertEquals("```foo'bar```", skip("```foo'bar```", 0)); + + assertEquals("-- comment\n", skip("-- comment\nselect * from foo", 0)); + assertEquals("# comment\n", skip("# comment\nselect * from foo", 0)); + assertEquals("/* comment */", skip("/* comment */ select * from foo", 0)); + assertEquals( + "/* comment /* GoogleSQL does not support nested comments */", + skip("/* comment /* GoogleSQL does not support nested comments */ select * from foo", 0)); + // GoogleSQL does not support dollar-quoted strings. + assertEquals("$", skip("$tag$not a string$tag$ select * from foo", 0)); + + assertEquals("/* 'test' */", skip("/* 'test' */ foo")); + assertEquals("-- 'test' \n", skip("-- 'test' \n foo")); + assertEquals("'/* test */'", skip("'/* test */' foo")); + + // Raw strings do not consider '\' as something that starts an escape sequence, but any + // quote character following it is still preserved within the string, as the definition of a + // raw string says that 'both characters are preserved'. + assertEquals("'foo\\''", skip("'foo\\'' ", 0)); + assertEquals("'foo\\''", skip("r'foo\\'' ", 1)); + assertEquals("'''foo\\'\\'\\'bar'''", skip("'''foo\\'\\'\\'bar''' ", 0)); + } +} diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/StatementParserTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/StatementParserTest.java index d3438b2b661..c60550c3ba6 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/StatementParserTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/StatementParserTest.java @@ -1600,11 +1600,11 @@ public void testPostgreSQLReturningClause() { } int skipSingleLineComment(String sql, int startIndex) { - return PostgreSQLStatementParser.skipSingleLineComment(sql, startIndex, null); + return AbstractStatementParser.skipSingleLineComment(sql, startIndex, null); } int skipMultiLineComment(String sql, int startIndex) { - return PostgreSQLStatementParser.skipMultiLineComment(sql, startIndex, null); + return parser.skipMultiLineComment(sql, startIndex, null); } @Test From 50e288791bf94903cc76e0c5a703a936cc9a5d3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Tue, 19 Mar 2024 11:42:17 +0100 Subject: [PATCH 15/47] perf: keep comments when searching for params (#2951) Keep all comments in the SQL string in place when converting positional parameters to named parameters. This reduces the amount of string operations that are needed for each query that is executed, and also enables actually sending comments from the client to Spanner when using positional parameters (e.g. in JDBC). This is step 3 in the refactoring to share more code between the SpannerStatementParser and PostgreSQLStatementParser. --- .../connection/AbstractStatementParser.java | 49 +-- .../connection/PostgreSQLStatementParser.java | 26 +- .../connection/SpannerStatementParser.java | 67 +--- .../SpannerStatementParserTest.java | 156 ++++++++ .../connection/StatementParserTest.java | 362 ++++++++---------- 5 files changed, 361 insertions(+), 299 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java index 13301181452..9793a50c636 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java @@ -634,36 +634,33 @@ public static class ParametersInfo { /** * Converts all positional parameters (?) in the given sql string into named parameters. The - * parameters are named @p1, @p2, etc. This method is used when converting a JDBC statement that - * uses positional parameters to a Cloud Spanner {@link Statement} instance that requires named - * parameters. The input SQL string may not contain any comments, except for PostgreSQL-dialect - * SQL strings. + * parameters are named @p1, @p2, etc. for GoogleSQL, and $1, $2, etc. for PostgreSQL. This method + * is used when converting a JDBC statement that uses positional parameters to a Cloud Spanner + * {@link Statement} instance that requires named parameters. * - * @param sql The sql string that should be converted - * @return A {@link ParametersInfo} object containing a string with named parameters instead of - * positional parameters and the number of parameters. - * @throws SpannerException If the input sql string contains an unclosed string/byte literal. - */ - @InternalApi - abstract ParametersInfo convertPositionalParametersToNamedParametersInternal( - char paramChar, String sql); - - /** - * Converts all positional parameters (?) in the given sql string into named parameters. The - * parameters are named @p1, @p2, etc. This method is used when converting a JDBC statement that - * uses positional parameters to a Cloud Spanner {@link Statement} instance that requires named - * parameters. The input SQL string may not contain any comments. There is an exception case if - * the statement starts with a GSQL comment which forces it to be interpreted as a GoogleSql - * statement. - * - * @param sql The sql string without comments that should be converted + * @param sql The sql string that should be converted to use named parameters * @return A {@link ParametersInfo} object containing a string with named parameters instead of * positional parameters and the number of parameters. * @throws SpannerException If the input sql string contains an unclosed string/byte literal. */ @InternalApi public ParametersInfo convertPositionalParametersToNamedParameters(char paramChar, String sql) { - return convertPositionalParametersToNamedParametersInternal(paramChar, sql); + Preconditions.checkNotNull(sql); + final String namedParamPrefix = getQueryParameterPrefix(); + StringBuilder named = new StringBuilder(sql.length() + countOccurrencesOf(paramChar, sql)); + int index = 0; + int paramIndex = 1; + while (index < sql.length()) { + char c = sql.charAt(index); + if (c == paramChar) { + named.append(namedParamPrefix).append(paramIndex); + paramIndex++; + index++; + } else { + index = skip(sql, index, named); + } + } + return new ParametersInfo(paramIndex - 1, named.toString()); } /** Convenience method that is used to estimate the number of parameters in a SQL statement. */ @@ -700,7 +697,8 @@ public boolean checkReturningClause(String sql) { } /** - * <<<<<<< HEAD Returns true if this dialect supports nested comments. + * <<<<<<< HEAD Returns true if this dialect supports nested comments. ======= <<<<<<< HEAD + * Returns true if this dialect supports nested comments. >>>>>>> main * *

    *
  • This method should return false for dialects that consider this to be a valid comment: @@ -755,6 +753,9 @@ public boolean checkReturningClause(String sql) { */ abstract boolean supportsLineFeedInQuotedString(); + /** Returns the query parameter prefix that should be used for this dialect. */ + abstract String getQueryParameterPrefix(); + /** * Returns true for characters that can be used as the first character in unquoted identifiers. */ diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/PostgreSQLStatementParser.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/PostgreSQLStatementParser.java index 6b0c69d40a9..be4aa9d7f46 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/PostgreSQLStatementParser.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/PostgreSQLStatementParser.java @@ -88,6 +88,11 @@ boolean supportsLineFeedInQuotedString() { return true; } + @Override + String getQueryParameterPrefix() { + return "$"; + } + /** * Removes comments from and trims the given sql statement. PostgreSQL supports two types of * comments: @@ -181,27 +186,6 @@ String removeStatementHint(String sql) { return sql; } - @InternalApi - @Override - ParametersInfo convertPositionalParametersToNamedParametersInternal(char paramChar, String sql) { - Preconditions.checkNotNull(sql); - final String namedParamPrefix = "$"; - StringBuilder named = new StringBuilder(sql.length() + countOccurrencesOf(paramChar, sql)); - int index = 0; - int paramIndex = 1; - while (index < sql.length()) { - char c = sql.charAt(index); - if (c == paramChar) { - named.append(namedParamPrefix).append(paramIndex); - paramIndex++; - index++; - } else { - index = skip(sql, index, named); - } - } - return new ParametersInfo(paramIndex - 1, named.toString()); - } - /** * Note: This is an internal API and breaking changes can be made without prior notice. * diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SpannerStatementParser.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SpannerStatementParser.java index 1c5cdda7b01..892672ad0df 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SpannerStatementParser.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SpannerStatementParser.java @@ -90,6 +90,11 @@ boolean supportsLineFeedInQuotedString() { return false; } + @Override + String getQueryParameterPrefix() { + return "@p"; + } + /** * Removes comments from and trims the given sql statement. Spanner supports three types of * comments: @@ -250,68 +255,6 @@ String removeStatementHint(String sql) { return sql; } - @InternalApi - @Override - ParametersInfo convertPositionalParametersToNamedParametersInternal(char paramChar, String sql) { - boolean isInQuoted = false; - char startQuote = 0; - boolean lastCharWasEscapeChar = false; - boolean isTripleQuoted = false; - int paramIndex = 1; - StringBuilder named = new StringBuilder(sql.length() + countOccurrencesOf(paramChar, sql)); - for (int index = 0; index < sql.length(); index++) { - char c = sql.charAt(index); - if (isInQuoted) { - if ((c == '\n' || c == '\r') && !isTripleQuoted) { - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.INVALID_ARGUMENT, "SQL statement contains an unclosed literal: " + sql); - } else if (c == startQuote) { - if (lastCharWasEscapeChar) { - lastCharWasEscapeChar = false; - } else if (isTripleQuoted) { - if (sql.length() > index + 2 - && sql.charAt(index + 1) == startQuote - && sql.charAt(index + 2) == startQuote) { - isInQuoted = false; - startQuote = 0; - isTripleQuoted = false; - } - } else { - isInQuoted = false; - startQuote = 0; - } - } else if (c == '\\') { - lastCharWasEscapeChar = true; - } else { - lastCharWasEscapeChar = false; - } - named.append(c); - } else { - if (c == paramChar) { - named.append("@p" + paramIndex); - paramIndex++; - } else { - if (c == SINGLE_QUOTE || c == DOUBLE_QUOTE || c == BACKTICK_QUOTE) { - isInQuoted = true; - startQuote = c; - // check whether it is a triple-quote - if (sql.length() > index + 2 - && sql.charAt(index + 1) == startQuote - && sql.charAt(index + 2) == startQuote) { - isTripleQuoted = true; - } - } - named.append(c); - } - } - } - if (isInQuoted) { - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.INVALID_ARGUMENT, "SQL statement contains an unclosed literal: " + sql); - } - return new ParametersInfo(paramIndex - 1, named.toString()); - } - private boolean isReturning(String sql, int index) { return (index >= 1) && (index + 12 <= sql.length()) diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/SpannerStatementParserTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/SpannerStatementParserTest.java index d4dc76d48bb..5cec5d838d1 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/SpannerStatementParserTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/SpannerStatementParserTest.java @@ -16,9 +16,11 @@ package com.google.cloud.spanner.connection; +import static com.google.cloud.spanner.connection.StatementParserTest.assertUnclosedLiteral; import static org.junit.Assert.assertEquals; import com.google.cloud.spanner.Dialect; +import com.google.cloud.spanner.connection.StatementParserTest.CommentInjector; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -80,4 +82,158 @@ public void testSkip() { assertEquals("'foo\\''", skip("r'foo\\'' ", 1)); assertEquals("'''foo\\'\\'\\'bar'''", skip("'''foo\\'\\'\\'bar''' ", 0)); } + + @Test + public void testConvertPositionalParametersToNamedParameters() { + AbstractStatementParser parser = + AbstractStatementParser.getInstance(Dialect.GOOGLE_STANDARD_SQL); + + for (String comment : + new String[] { + "-- test comment\n", + "/* another test comment */", + "/* comment\nwith\nmultiple\nlines\n */", + "/* comment /* with nested */ comment */" + }) { + for (CommentInjector injector : CommentInjector.values()) { + assertEquals( + injector.inject("select * %sfrom foo where name=@p1", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("select * %sfrom foo where name=?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("@p1%s'?test?\"?test?\"?'@p2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?%s'?test?\"?test?\"?'?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("@p1'?it\\'?s'%s@p2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?'?it\\'?s'%s?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("@p1'?it\\\"?s'%s@p2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?'?it\\\"?s'%s?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("@p1\"?it\\\"?s\"%s@p2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?\"?it\\\"?s\"%s?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("@p1%s'''?it\\''?s'''@p2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?%s'''?it\\''?s'''?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("@p1\"\"\"?it\\\"\"?s\"\"\"%s@p2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?\"\"\"?it\\\"\"?s\"\"\"%s?", comment)) + .sqlWithNamedParameters); + + // GoogleSQL does not support dollar-quoted strings, so these are all ignored. + assertEquals( + injector.inject("@p1$$@p2it$@p3s$$%s@p4", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?$$?it$?s$$%s?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("@p1$tag$@p2it$$@p3s$tag$%s@p4", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?$tag$?it$$?s$tag$%s?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("@p1%s$$@p2it\\'?s \t ?it\\'?s'$$@p3", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?%s$$?it\\'?s \t ?it\\'?s'$$?", comment)) + .sqlWithNamedParameters); + + // Note: GoogleSQL does not allowa a single-quoted string literal to contain line feeds. + assertUnclosedLiteral(parser, injector.inject("?'?it\\''?s \n ?it\\''?s'%s?", comment)); + assertEquals( + "@p1'?it\\''@p2s \n @p3it\\''@p4s@p5", + parser.convertPositionalParametersToNamedParameters('?', "?'?it\\''?s \n ?it\\''?s?") + .sqlWithNamedParameters); + assertEquals( + injector.inject("@p1%s'''?it\\''?s \n ?it\\''?s'''@p2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?%s'''?it\\''?s \n ?it\\''?s'''?", comment)) + .sqlWithNamedParameters); + + assertEquals( + injector.inject( + "select 1, @p1, 'test?test', \"test?test\", %sfoo.* from `foo` where col1=@p2 and col2='test' and col3=@p3 and col4='?' and col5=\"?\" and col6='?''?''?'", + comment), + parser.convertPositionalParametersToNamedParameters( + '?', + injector.inject( + "select 1, ?, 'test?test', \"test?test\", %sfoo.* from `foo` where col1=? and col2='test' and col3=? and col4='?' and col5=\"?\" and col6='?''?''?'", + comment)) + .sqlWithNamedParameters); + + assertEquals( + injector.inject( + "select * " + + "%sfrom foo " + + "where name=@p1 " + + "and col2 like @p2 " + + "and col3 > @p3", + comment), + parser.convertPositionalParametersToNamedParameters( + '?', + injector.inject( + "select * " + + "%sfrom foo " + + "where name=? " + + "and col2 like ? " + + "and col3 > ?", + comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("select * " + "from foo " + "where id between @p1%s and @p2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', + injector.inject( + "select * " + "from foo " + "where id between ?%s and ?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("select * " + "from foo " + "limit @p1 %s offset @p2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', + injector.inject("select * " + "from foo " + "limit ? %s offset ?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject( + "select * " + + "from foo " + + "where col1=@p1 " + + "and col2 like @p2 " + + " %s " + + "and col3 > @p3 " + + "and col4 < @p4 " + + "and col5 != @p5 " + + "and col6 not in (@p6, @p7, @p8) " + + "and col7 in (@p9, @p10, @p11) " + + "and col8 between @p12 and @p13", + comment), + parser.convertPositionalParametersToNamedParameters( + '?', + injector.inject( + "select * " + + "from foo " + + "where col1=? " + + "and col2 like ? " + + " %s " + + "and col3 > ? " + + "and col4 < ? " + + "and col5 != ? " + + "and col6 not in (?, ?, ?) " + + "and col7 in (?, ?, ?) " + + "and col8 between ? and ?", + comment)) + .sqlWithNamedParameters); + } + } + } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/StatementParserTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/StatementParserTest.java index c60550c3ba6..3739aa11064 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/StatementParserTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/StatementParserTest.java @@ -17,12 +17,11 @@ package com.google.cloud.spanner.connection; import static com.google.common.truth.Truth.assertThat; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.junit.Assume.assumeTrue; @@ -1066,85 +1065,86 @@ private void testParseStatementWithOneParame public void testGoogleStandardSQLDialectConvertPositionalParametersToNamedParameters() { assumeTrue(dialect == Dialect.GOOGLE_STANDARD_SQL); - assertThat( - parser.convertPositionalParametersToNamedParameters( - '?', "select * from foo where name=?") - .sqlWithNamedParameters) - .isEqualTo("select * from foo where name=@p1"); - assertThat( - parser.convertPositionalParametersToNamedParameters('?', "?'?test?\"?test?\"?'?") - .sqlWithNamedParameters) - .isEqualTo("@p1'?test?\"?test?\"?'@p2"); - assertThat( - parser.convertPositionalParametersToNamedParameters('?', "?'?it\\'?s'?") - .sqlWithNamedParameters) - .isEqualTo("@p1'?it\\'?s'@p2"); - assertThat( - parser.convertPositionalParametersToNamedParameters('?', "?'?it\\\"?s'?") - .sqlWithNamedParameters) - .isEqualTo("@p1'?it\\\"?s'@p2"); - assertThat( - parser.convertPositionalParametersToNamedParameters('?', "?\"?it\\\"?s\"?") - .sqlWithNamedParameters) - .isEqualTo("@p1\"?it\\\"?s\"@p2"); - assertThat( - parser.convertPositionalParametersToNamedParameters('?', "?'''?it\\'?s'''?") - .sqlWithNamedParameters) - .isEqualTo("@p1'''?it\\'?s'''@p2"); - assertThat( - parser.convertPositionalParametersToNamedParameters('?', "?\"\"\"?it\\\"?s\"\"\"?") - .sqlWithNamedParameters) - .isEqualTo("@p1\"\"\"?it\\\"?s\"\"\"@p2"); + assertEquals( + "select * from foo where name=@p1", + parser.convertPositionalParametersToNamedParameters('?', "select * from foo where name=?") + .sqlWithNamedParameters); + assertEquals( + "@p1'?test?\"?test?\"?'@p2", + parser.convertPositionalParametersToNamedParameters('?', "?'?test?\"?test?\"?'?") + .sqlWithNamedParameters); + assertEquals( + "@p1'?it\\'?s'@p2", + parser.convertPositionalParametersToNamedParameters('?', "?'?it\\'?s'?") + .sqlWithNamedParameters); + assertEquals( + "@p1'?it\\\"?s'@p2", + parser.convertPositionalParametersToNamedParameters('?', "?'?it\\\"?s'?") + .sqlWithNamedParameters); + assertEquals( + "@p1\"?it\\\"?s\"@p2", + parser.convertPositionalParametersToNamedParameters('?', "?\"?it\\\"?s\"?") + .sqlWithNamedParameters); + assertEquals( + "@p1'''?it\\'?s'''@p2", + parser.convertPositionalParametersToNamedParameters('?', "?'''?it\\'?s'''?") + .sqlWithNamedParameters); + assertEquals( + "@p1\"\"\"?it\\\"?s\"\"\"@p2", + parser.convertPositionalParametersToNamedParameters('?', "?\"\"\"?it\\\"?s\"\"\"?") + .sqlWithNamedParameters); - assertThat( - parser.convertPositionalParametersToNamedParameters('?', "?`?it\\`?s`?") - .sqlWithNamedParameters) - .isEqualTo("@p1`?it\\`?s`@p2"); - assertThat( - parser.convertPositionalParametersToNamedParameters('?', "?```?it\\`?s```?") - .sqlWithNamedParameters) - .isEqualTo("@p1```?it\\`?s```@p2"); - assertThat( - parser.convertPositionalParametersToNamedParameters('?', "?'''?it\\'?s \n ?it\\'?s'''?") - .sqlWithNamedParameters) - .isEqualTo("@p1'''?it\\'?s \n ?it\\'?s'''@p2"); + assertEquals( + "@p1`?it\\`?s`@p2", + parser.convertPositionalParametersToNamedParameters('?', "?`?it\\`?s`?") + .sqlWithNamedParameters); + assertEquals( + "@p1```?it\\`?s```@p2", + parser.convertPositionalParametersToNamedParameters('?', "?```?it\\`?s```?") + .sqlWithNamedParameters); + assertEquals( + "@p1'''?it\\'?s \n ?it\\'?s'''@p2", + parser.convertPositionalParametersToNamedParameters('?', "?'''?it\\'?s \n ?it\\'?s'''?") + .sqlWithNamedParameters); - assertUnclosedLiteral("?'?it\\'?s \n ?it\\'?s'?"); - assertUnclosedLiteral("?'?it\\'?s \n ?it\\'?s?"); - assertUnclosedLiteral("?'''?it\\'?s \n ?it\\'?s'?"); + assertUnclosedLiteral(parser, "?'?it\\'?s \n ?it\\'?s'?"); + assertUnclosedLiteral(parser, "?'?it\\'?s \n ?it\\'?s?"); + assertUnclosedLiteral(parser, "?'''?it\\'?s \n ?it\\'?s'?"); - assertThat( + assertEquals( + "select 1, @p1, 'test?test', \"test?test\", foo.* from `foo` where col1=@p2 and col2='test' and col3=@p3 and col4='?' and col5=\"?\" and col6='?''?''?'", parser.convertPositionalParametersToNamedParameters( '?', "select 1, ?, 'test?test', \"test?test\", foo.* from `foo` where col1=? and col2='test' and col3=? and col4='?' and col5=\"?\" and col6='?''?''?'") - .sqlWithNamedParameters, - is( - equalTo( - "select 1, @p1, 'test?test', \"test?test\", foo.* from `foo` where col1=@p2 and col2='test' and col3=@p3 and col4='?' and col5=\"?\" and col6='?''?''?'"))); + .sqlWithNamedParameters); - assertThat( + assertEquals( + "select * " + "from foo " + "where name=@p1 " + "and col2 like @p2 " + "and col3 > @p3", parser.convertPositionalParametersToNamedParameters( '?', "select * " + "from foo " + "where name=? " + "and col2 like ? " + "and col3 > ?") - .sqlWithNamedParameters, - is( - equalTo( - "select * " - + "from foo " - + "where name=@p1 " - + "and col2 like @p2 " - + "and col3 > @p3"))); - assertThat( + .sqlWithNamedParameters); + assertEquals( + "select * " + "from foo " + "where id between @p1 and @p2", parser.convertPositionalParametersToNamedParameters( '?', "select * " + "from foo " + "where id between ? and ?") - .sqlWithNamedParameters, - is(equalTo("select * " + "from foo " + "where id between @p1 and @p2"))); - assertThat( + .sqlWithNamedParameters); + assertEquals( + "select * " + "from foo " + "limit @p1 offset @p2", parser.convertPositionalParametersToNamedParameters( '?', "select * " + "from foo " + "limit ? offset ?") - .sqlWithNamedParameters, - is(equalTo("select * " + "from foo " + "limit @p1 offset @p2"))); - assertThat( + .sqlWithNamedParameters); + assertEquals( + "select * " + + "from foo " + + "where col1=@p1 " + + "and col2 like @p2 " + + "and col3 > @p3 " + + "and col4 < @p4 " + + "and col5 != @p5 " + + "and col6 not in (@p6, @p7, @p8) " + + "and col7 in (@p9, @p10, @p11) " + + "and col8 between @p12 and @p13", parser.convertPositionalParametersToNamedParameters( '?', "select * " @@ -1157,22 +1157,10 @@ public void testGoogleStandardSQLDialectConvertPositionalParametersToNamedParame + "and col6 not in (?, ?, ?) " + "and col7 in (?, ?, ?) " + "and col8 between ? and ?") - .sqlWithNamedParameters, - is( - equalTo( - "select * " - + "from foo " - + "where col1=@p1 " - + "and col2 like @p2 " - + "and col3 > @p3 " - + "and col4 < @p4 " - + "and col5 != @p5 " - + "and col6 not in (@p6, @p7, @p8) " - + "and col7 in (@p9, @p10, @p11) " - + "and col8 between @p12 and @p13"))); + .sqlWithNamedParameters); } - private enum CommentInjector { + enum CommentInjector { NONE { @Override String inject(String sql, String comment) { @@ -1213,57 +1201,57 @@ public void testPostgreSQLDialectDialectConvertPositionalParametersToNamedParame "/* comment /* with nested */ comment */" }) { for (CommentInjector injector : CommentInjector.values()) { - assertThat( - parser.convertPositionalParametersToNamedParameters( - '?', injector.inject("select * %sfrom foo where name=?", comment)) - .sqlWithNamedParameters) - .isEqualTo(injector.inject("select * %sfrom foo where name=$1", comment)); - assertThat( - parser.convertPositionalParametersToNamedParameters( - '?', injector.inject("?%s'?test?\"?test?\"?'?", comment)) - .sqlWithNamedParameters) - .isEqualTo(injector.inject("$1%s'?test?\"?test?\"?'$2", comment)); - assertThat( - parser.convertPositionalParametersToNamedParameters( - '?', injector.inject("?'?it\\''?s'%s?", comment)) - .sqlWithNamedParameters) - .isEqualTo(injector.inject("$1'?it\\''?s'%s$2", comment)); - assertThat( - parser.convertPositionalParametersToNamedParameters( - '?', injector.inject("?'?it\\\"?s'%s?", comment)) - .sqlWithNamedParameters) - .isEqualTo(injector.inject("$1'?it\\\"?s'%s$2", comment)); - assertThat( - parser.convertPositionalParametersToNamedParameters( - '?', injector.inject("?\"?it\\\"\"?s\"%s?", comment)) - .sqlWithNamedParameters) - .isEqualTo(injector.inject("$1\"?it\\\"\"?s\"%s$2", comment)); - assertThat( - parser.convertPositionalParametersToNamedParameters( - '?', injector.inject("?%s'''?it\\''?s'''?", comment)) - .sqlWithNamedParameters) - .isEqualTo(injector.inject("$1%s'''?it\\''?s'''$2", comment)); - assertThat( - parser.convertPositionalParametersToNamedParameters( - '?', injector.inject("?\"\"\"?it\\\"\"?s\"\"\"%s?", comment)) - .sqlWithNamedParameters) - .isEqualTo(injector.inject("$1\"\"\"?it\\\"\"?s\"\"\"%s$2", comment)); - - assertThat( - parser.convertPositionalParametersToNamedParameters( - '?', injector.inject("?$$?it$?s$$%s?", comment)) - .sqlWithNamedParameters) - .isEqualTo(injector.inject("$1$$?it$?s$$%s$2", comment)); - assertThat( - parser.convertPositionalParametersToNamedParameters( - '?', injector.inject("?$tag$?it$$?s$tag$%s?", comment)) - .sqlWithNamedParameters) - .isEqualTo(injector.inject("$1$tag$?it$$?s$tag$%s$2", comment)); - assertThat( - parser.convertPositionalParametersToNamedParameters( - '?', injector.inject("?%s$$?it\\'?s \n ?it\\'?s$$?", comment)) - .sqlWithNamedParameters) - .isEqualTo(injector.inject("$1%s$$?it\\'?s \n ?it\\'?s$$$2", comment)); + assertEquals( + injector.inject("select * %sfrom foo where name=$1", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("select * %sfrom foo where name=?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("$1%s'?test?\"?test?\"?'$2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?%s'?test?\"?test?\"?'?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("$1'?it\\''?s'%s$2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?'?it\\''?s'%s?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("$1'?it\\\"?s'%s$2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?'?it\\\"?s'%s?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("$1\"?it\\\"\"?s\"%s$2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?\"?it\\\"\"?s\"%s?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("$1%s'''?it\\''?s'''$2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?%s'''?it\\''?s'''?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("$1\"\"\"?it\\\"\"?s\"\"\"%s$2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?\"\"\"?it\\\"\"?s\"\"\"%s?", comment)) + .sqlWithNamedParameters); + + assertEquals( + injector.inject("$1$$?it$?s$$%s$2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?$$?it$?s$$%s?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("$1$tag$?it$$?s$tag$%s$2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?$tag$?it$$?s$tag$%s?", comment)) + .sqlWithNamedParameters); + assertEquals( + injector.inject("$1%s$$?it\\'?s \n ?it\\'?s$$$2", comment), + parser.convertPositionalParametersToNamedParameters( + '?', injector.inject("?%s$$?it\\'?s \n ?it\\'?s$$?", comment)) + .sqlWithNamedParameters); // Note: PostgreSQL allows a single-quoted string literal to contain line feeds. assertEquals( @@ -1271,27 +1259,32 @@ public void testPostgreSQLDialectDialectConvertPositionalParametersToNamedParame parser.convertPositionalParametersToNamedParameters( '?', injector.inject("?'?it\\''?s \n ?it\\''?s'%s?", comment)) .sqlWithNamedParameters); - assertUnclosedLiteral("?'?it\\''?s \n ?it\\''?s?"); + assertUnclosedLiteral(parser, "?'?it\\''?s \n ?it\\''?s?"); assertEquals( injector.inject("$1%s'''?it\\''?s \n ?it\\''?s'$2", comment), parser.convertPositionalParametersToNamedParameters( '?', injector.inject("?%s'''?it\\''?s \n ?it\\''?s'?", comment)) .sqlWithNamedParameters); - assertThat( + assertEquals( + injector.inject( + "select 1, $1, 'test?test', \"test?test\", %sfoo.* from `foo` where col1=$2 and col2='test' and col3=$3 and col4='?' and col5=\"?\" and col6='?''?''?'", + comment), parser.convertPositionalParametersToNamedParameters( '?', injector.inject( "select 1, ?, 'test?test', \"test?test\", %sfoo.* from `foo` where col1=? and col2='test' and col3=? and col4='?' and col5=\"?\" and col6='?''?''?'", comment)) - .sqlWithNamedParameters, - is( - equalTo( - injector.inject( - "select 1, $1, 'test?test', \"test?test\", %sfoo.* from `foo` where col1=$2 and col2='test' and col3=$3 and col4='?' and col5=\"?\" and col6='?''?''?'", - comment)))); + .sqlWithNamedParameters); - assertThat( + assertEquals( + injector.inject( + "select * " + + "%sfrom foo " + + "where name=$1 " + + "and col2 like $2 " + + "and col3 > $3", + comment), parser.convertPositionalParametersToNamedParameters( '?', injector.inject( @@ -1301,36 +1294,34 @@ public void testPostgreSQLDialectDialectConvertPositionalParametersToNamedParame + "and col2 like ? " + "and col3 > ?", comment)) - .sqlWithNamedParameters, - is( - equalTo( - injector.inject( - "select * " - + "%sfrom foo " - + "where name=$1 " - + "and col2 like $2 " - + "and col3 > $3", - comment)))); - assertThat( + .sqlWithNamedParameters); + assertEquals( + injector.inject("select * " + "from foo " + "where id between $1%s and $2", comment), parser.convertPositionalParametersToNamedParameters( '?', injector.inject( "select * " + "from foo " + "where id between ?%s and ?", comment)) - .sqlWithNamedParameters, - is( - equalTo( - injector.inject( - "select * " + "from foo " + "where id between $1%s and $2", comment)))); - assertThat( + .sqlWithNamedParameters); + assertEquals( + injector.inject("select * " + "from foo " + "limit $1 %s offset $2", comment), parser.convertPositionalParametersToNamedParameters( '?', injector.inject("select * " + "from foo " + "limit ? %s offset ?", comment)) - .sqlWithNamedParameters, - is( - equalTo( - injector.inject( - "select * " + "from foo " + "limit $1 %s offset $2", comment)))); - assertThat( + .sqlWithNamedParameters); + assertEquals( + injector.inject( + "select * " + + "from foo " + + "where col1=$1 " + + "and col2 like $2 " + + " %s " + + "and col3 > $3 " + + "and col4 < $4 " + + "and col5 != $5 " + + "and col6 not in ($6, $7, $8) " + + "and col7 in ($9, $10, $11) " + + "and col8 between $12 and $13", + comment), parser.convertPositionalParametersToNamedParameters( '?', injector.inject( @@ -1346,22 +1337,7 @@ public void testPostgreSQLDialectDialectConvertPositionalParametersToNamedParame + "and col7 in (?, ?, ?) " + "and col8 between ? and ?", comment)) - .sqlWithNamedParameters, - is( - equalTo( - injector.inject( - "select * " - + "from foo " - + "where col1=$1 " - + "and col2 like $2 " - + " %s " - + "and col3 > $3 " - + "and col4 < $4 " - + "and col5 != $5 " - + "and col6 not in ($6, $7, $8) " - + "and col7 in ($9, $10, $11) " - + "and col8 between $12 and $13", - comment)))); + .sqlWithNamedParameters); } } } @@ -1714,18 +1690,20 @@ public void testStatementCache_ParameterizedStatement() { assertEquals(1, stats.hitCount()); } - private void assertUnclosedLiteral(String sql) { - try { - parser.convertPositionalParametersToNamedParameters('?', sql); - fail("missing expected exception"); - } catch (SpannerException e) { - assertThat(e.getErrorCode()).isSameInstanceAs(ErrorCode.INVALID_ARGUMENT); - assertThat(e.getMessage()) - .startsWith( - ErrorCode.INVALID_ARGUMENT.name() - + ": SQL statement contains an unclosed literal: " - + sql); - } + static void assertUnclosedLiteral(AbstractStatementParser parser, String sql) { + SpannerException exception = + assertThrows( + SpannerException.class, + () -> parser.convertPositionalParametersToNamedParameters('?', sql)); + assertEquals(ErrorCode.INVALID_ARGUMENT, exception.getErrorCode()); + assertTrue( + exception.getMessage(), + exception + .getMessage() + .startsWith( + ErrorCode.INVALID_ARGUMENT.name() + + ": SQL statement contains an unclosed literal: " + + sql)); } @SuppressWarnings("unchecked") From 62582935f285fcbcb26cc1f8e8649ccf11266eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Tue, 19 Mar 2024 12:33:10 +0100 Subject: [PATCH 16/47] chore: randomize session pool order based on TPS (#2792) * chore: randomize session pool order based on TPS * chore: remove unnecessary changes --- .../com/google/cloud/spanner/SessionPool.java | 47 +++++++++++-- .../cloud/spanner/SessionPoolOptions.java | 23 ++++++ .../spanner/SessionPoolMaintainerTest.java | 70 +++++++++++++++++++ .../cloud/spanner/SessionPoolOptionsTest.java | 28 ++++++++ 4 files changed, 164 insertions(+), 4 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java index 3e01112366c..8058802a8fc 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java @@ -1751,6 +1751,13 @@ final class PoolMaintainer { */ @VisibleForTesting Instant lastExecutionTime; + /** + * The previous numSessionsAcquired seen by the maintainer. This is used to calculate the + * transactions per second, which again is used to determine whether to randomize the order of + * the session pool. + */ + private long prevNumSessionsAcquired; + boolean closed = false; @GuardedBy("lock") @@ -1794,6 +1801,12 @@ void maintainPool() { return; } running = true; + if (loopFrequency >= 1000L) { + SessionPool.this.transactionsPerSecond = + (SessionPool.this.numSessionsAcquired - prevNumSessionsAcquired) + / (loopFrequency / 1000L); + } + this.prevNumSessionsAcquired = SessionPool.this.numSessionsAcquired; } Instant currTime = clock.instant(); removeIdleSessions(currTime); @@ -1995,6 +2008,7 @@ enum Position { private final SettableFuture dialect = SettableFuture.create(); private final String databaseRole; private final SessionClient sessionClient; + private final int numChannels; private final ScheduledExecutorService executor; private final ExecutorFactory executorFactory; @@ -2054,6 +2068,9 @@ enum Position { @GuardedBy("lock") private long numIdleSessionsRemoved = 0; + @GuardedBy("lock") + private long transactionsPerSecond = 0L; + @GuardedBy("lock") private long numLeakedSessionsRemoved = 0; @@ -2190,6 +2207,7 @@ private SessionPool( this.executorFactory = executorFactory; this.executor = executor; this.sessionClient = sessionClient; + this.numChannels = sessionClient.getSpanner().getOptions().getNumChannels(); this.clock = clock; this.initialReleasePosition = initialReleasePosition; this.poolMaintainer = new PoolMaintainer(); @@ -2493,11 +2511,13 @@ private void releaseSession( if (closureFuture != null) { return; } - if (waiters.size() == 0) { + if (waiters.isEmpty()) { // There are no pending waiters. - // Add to a random position if the head of the session pool already contains many sessions - // with the same channel as this one. - if (session.releaseToPosition == Position.FIRST && isUnbalanced(session)) { + // Add to a random position if the transactions per second is high or the head of the + // session pool already contains many sessions with the same channel as this one. + if (session.releaseToPosition != Position.RANDOM && shouldRandomize()) { + session.releaseToPosition = Position.RANDOM; + } else if (session.releaseToPosition == Position.FIRST && isUnbalanced(session)) { session.releaseToPosition = Position.RANDOM; } else if (session.releaseToPosition == Position.RANDOM && !isNewSession @@ -2532,6 +2552,25 @@ private void releaseSession( } } + /** + * Returns true if the position where we return the session should be random if: + * + *
      + *
    1. The current TPS is higher than the configured threshold. + *
    2. AND the number of sessions checked out is larger than the number of channels. + *
    + * + * The second check prevents the session pool from being randomized when the application is + * running many small, quick queries using a small number of parallel threads. This can cause a + * high TPS, without actually having a high degree of parallelism. + */ + @VisibleForTesting + boolean shouldRandomize() { + return this.options.getRandomizePositionQPSThreshold() > 0 + && this.transactionsPerSecond >= this.options.getRandomizePositionQPSThreshold() + && this.numSessionsInUse >= this.numChannels; + } + private boolean isUnbalanced(PooledSession session) { int channel = session.getChannel(); int numChannels = sessionClient.getSpanner().getOptions().getNumChannels(); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java index 80d53a4d71f..2ebe77e1ba2 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java @@ -64,6 +64,7 @@ public class SessionPoolOptions { private final Duration waitForMinSessions; private final Duration acquireSessionTimeout; private final Position releaseToPosition; + private final long randomizePositionQPSThreshold; /** Property for allowing mocking of session maintenance clock. */ private final Clock poolMaintainerClock; @@ -89,6 +90,7 @@ private SessionPoolOptions(Builder builder) { this.waitForMinSessions = builder.waitForMinSessions; this.acquireSessionTimeout = builder.acquireSessionTimeout; this.releaseToPosition = builder.releaseToPosition; + this.randomizePositionQPSThreshold = builder.randomizePositionQPSThreshold; this.inactiveTransactionRemovalOptions = builder.inactiveTransactionRemovalOptions; this.poolMaintainerClock = builder.poolMaintainerClock; } @@ -118,6 +120,7 @@ public boolean equals(Object o) { && Objects.equals(this.waitForMinSessions, other.waitForMinSessions) && Objects.equals(this.acquireSessionTimeout, other.acquireSessionTimeout) && Objects.equals(this.releaseToPosition, other.releaseToPosition) + && Objects.equals(this.randomizePositionQPSThreshold, other.randomizePositionQPSThreshold) && Objects.equals( this.inactiveTransactionRemovalOptions, other.inactiveTransactionRemovalOptions) && Objects.equals(this.poolMaintainerClock, other.poolMaintainerClock); @@ -143,6 +146,7 @@ public int hashCode() { this.waitForMinSessions, this.acquireSessionTimeout, this.releaseToPosition, + this.randomizePositionQPSThreshold, this.inactiveTransactionRemovalOptions, this.poolMaintainerClock); } @@ -263,6 +267,10 @@ Position getReleaseToPosition() { return releaseToPosition; } + long getRandomizePositionQPSThreshold() { + return randomizePositionQPSThreshold; + } + public static Builder newBuilder() { return new Builder(); } @@ -451,6 +459,13 @@ public static class Builder { private Duration waitForMinSessions = Duration.ZERO; private Duration acquireSessionTimeout = Duration.ofSeconds(60); private Position releaseToPosition = getReleaseToPositionFromSystemProperty(); + /** + * The session pool will randomize the position of a session that is being returned when this + * threshold is exceeded. That is: If the transactions per second exceeds this threshold, then + * the session pool will use a random order for the sessions instead of LIFO. The default is 0, + * which means that the option is disabled. + */ + private long randomizePositionQPSThreshold = 0L; private Clock poolMaintainerClock; @@ -487,6 +502,7 @@ private Builder(SessionPoolOptions options) { this.autoDetectDialect = options.autoDetectDialect; this.waitForMinSessions = options.waitForMinSessions; this.acquireSessionTimeout = options.acquireSessionTimeout; + this.randomizePositionQPSThreshold = options.randomizePositionQPSThreshold; this.inactiveTransactionRemovalOptions = options.inactiveTransactionRemovalOptions; this.poolMaintainerClock = options.poolMaintainerClock; } @@ -764,6 +780,13 @@ Builder setReleaseToPosition(Position releaseToPosition) { return this; } + Builder setRandomizePositionQPSThreshold(long randomizePositionQPSThreshold) { + Preconditions.checkArgument( + randomizePositionQPSThreshold >= 0L, "randomizePositionQPSThreshold must be >= 0"); + this.randomizePositionQPSThreshold = randomizePositionQPSThreshold; + return this; + } + /** Build a SessionPoolOption object */ public SessionPoolOptions build() { validate(); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolMaintainerTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolMaintainerTest.java index f629c0fc1d6..b489511b73b 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolMaintainerTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolMaintainerTest.java @@ -18,6 +18,8 @@ import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; @@ -29,6 +31,7 @@ import com.google.cloud.spanner.SessionPool.PooledSessionFuture; import com.google.cloud.spanner.SessionPool.Position; import com.google.cloud.spanner.SessionPool.SessionConsumerImpl; +import com.google.common.base.Preconditions; import io.opencensus.trace.Tracing; import io.opentelemetry.api.OpenTelemetry; import java.util.ArrayList; @@ -116,6 +119,10 @@ private SessionImpl setupMockSession(final SessionImpl session, final ReadContex } private SessionPool createPool() throws Exception { + return createPool(this.options); + } + + private SessionPool createPool(SessionPoolOptions options) throws Exception { // Allow sessions to be added to the head of the pool in all cases in this test, as it is // otherwise impossible to know which session exactly is getting pinged at what point in time. SessionPool pool = @@ -324,4 +331,67 @@ public void testIdleSessions() throws Exception { } assertThat(pool.totalSessions()).isEqualTo(options.getMinSessions()); } + + @Test + public void testRandomizeThreshold() throws Exception { + SessionPool pool = + createPool( + this.options + .toBuilder() + .setMaxSessions(400) + .setLoopFrequency(1000L) + .setRandomizePositionQPSThreshold(4) + .build()); + List sessions; + + // Run a maintenance loop. No sessions have been checked out so far, so the TPS should be 0. + runMaintenanceLoop(clock, pool, 1); + assertFalse(pool.shouldRandomize()); + + // Get and return one session. This means TPS == 1. + returnSessions(1, useSessions(1, pool)); + runMaintenanceLoop(clock, pool, 1); + assertFalse(pool.shouldRandomize()); + + // Get and return four sessions. This means TPS == 4, and that no sessions are checked out. + returnSessions(4, useSessions(4, pool)); + runMaintenanceLoop(clock, pool, 1); + assertFalse(pool.shouldRandomize()); + + // Get four sessions without returning them. + // This means TPS == 4 and that they are all still checked out. + sessions = useSessions(4, pool); + runMaintenanceLoop(clock, pool, 1); + assertTrue(pool.shouldRandomize()); + // Returning one of the sessions reduces the number of checked out sessions enough to stop the + // randomizing. + returnSessions(1, sessions); + runMaintenanceLoop(clock, pool, 1); + assertFalse(pool.shouldRandomize()); + + // Get three more session and run the maintenance loop. + // The TPS is then 3, as we've only gotten 3 sessions since the last maintenance run. + // That means that we should not randomize. + sessions.addAll(useSessions(3, pool)); + runMaintenanceLoop(clock, pool, 1); + assertFalse(pool.shouldRandomize()); + + returnSessions(sessions.size(), sessions); + } + + private List useSessions(int numSessions, SessionPool pool) { + List sessions = new ArrayList<>(numSessions); + for (int i = 0; i < numSessions; i++) { + sessions.add(pool.getSession()); + sessions.get(sessions.size() - 1).singleUse().executeQuery(Statement.of("SELECT 1")).next(); + } + return sessions; + } + + private void returnSessions(int numSessions, List sessions) { + Preconditions.checkArgument(numSessions <= sessions.size()); + for (int i = 0; i < numSessions; i++) { + sessions.remove(0).close(); + } + } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolOptionsTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolOptionsTest.java index 23aa626f393..22d10d92a87 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolOptionsTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolOptionsTest.java @@ -19,6 +19,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -218,4 +219,31 @@ public void verifyDefaultAcquireSessionTimeout() { assertEquals(Duration.ofSeconds(60), sessionPoolOptions.getAcquireSessionTimeout()); } + + @Test + public void testRandomizePositionQPSThreshold() { + assertEquals(0L, SessionPoolOptions.newBuilder().build().getRandomizePositionQPSThreshold()); + assertEquals( + 4L, + SessionPoolOptions.newBuilder() + .setRandomizePositionQPSThreshold(4L) + .build() + .getRandomizePositionQPSThreshold()); + assertEquals( + 10L, + SessionPoolOptions.newBuilder() + .setRandomizePositionQPSThreshold(4L) + .setRandomizePositionQPSThreshold(10L) + .build() + .getRandomizePositionQPSThreshold()); + assertEquals( + 0L, + SessionPoolOptions.newBuilder() + .setRandomizePositionQPSThreshold(0L) + .build() + .getRandomizePositionQPSThreshold()); + assertThrows( + IllegalArgumentException.class, + () -> SessionPoolOptions.newBuilder().setRandomizePositionQPSThreshold(-1L)); + } } From d94922f4d4457c5f58edbe9fc6939f194efcb923 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 19 Mar 2024 17:58:37 +0530 Subject: [PATCH 17/47] chore(main): release 6.62.0 (#2940) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 31 +++++++++++++++++++ google-cloud-spanner-bom/pom.xml | 18 +++++------ google-cloud-spanner-executor/pom.xml | 4 +-- google-cloud-spanner/pom.xml | 4 +-- .../pom.xml | 4 +-- .../pom.xml | 4 +-- grpc-google-cloud-spanner-executor-v1/pom.xml | 4 +-- grpc-google-cloud-spanner-v1/pom.xml | 4 +-- pom.xml | 20 ++++++------ .../pom.xml | 4 +-- .../pom.xml | 4 +-- .../pom.xml | 4 +-- proto-google-cloud-spanner-v1/pom.xml | 4 +-- samples/snapshot/pom.xml | 2 +- versions.txt | 20 ++++++------ 15 files changed, 81 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2b269ee2ef..cf6dc252e4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,36 @@ # Changelog +## [6.62.0](https://github.com/googleapis/java-spanner/compare/v6.61.0...v6.62.0) (2024-03-19) + + +### Features + +* Allow attempt direct path xds via env var ([#2950](https://github.com/googleapis/java-spanner/issues/2950)) ([247a15f](https://github.com/googleapis/java-spanner/commit/247a15f2b8b858143bc906e0619f95a017ffe5c3)) +* Next release from main branch is 6.56.0 ([#2929](https://github.com/googleapis/java-spanner/issues/2929)) ([66374b1](https://github.com/googleapis/java-spanner/commit/66374b1c4ed88e01ff60fb8e1b7409e5dbbcb811)) + + +### Bug Fixes + +* Return type of max commit delay option. ([#2953](https://github.com/googleapis/java-spanner/issues/2953)) ([6e937ab](https://github.com/googleapis/java-spanner/commit/6e937ab16d130e72d633979c1a76bf7b3edbe7b6)) + + +### Performance Improvements + +* Keep comments when searching for params ([#2951](https://github.com/googleapis/java-spanner/issues/2951)) ([b782725](https://github.com/googleapis/java-spanner/commit/b782725b92a2662c42ad35647b23009ad95a99a5)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-monitoring to v3.38.0 ([#2942](https://github.com/googleapis/java-spanner/issues/2942)) ([ba665bd](https://github.com/googleapis/java-spanner/commit/ba665bd483ba70f09770d92028355ad499003fed)) +* Update dependency com.google.cloud:google-cloud-trace to v2.37.0 ([#2944](https://github.com/googleapis/java-spanner/issues/2944)) ([b5e608e](https://github.com/googleapis/java-spanner/commit/b5e608ef001473ab5575f1619804b351053c57f2)) +* Update dependency com.google.cloud:sdk-platform-java-config to v3.28.1 ([#2952](https://github.com/googleapis/java-spanner/issues/2952)) ([1e45237](https://github.com/googleapis/java-spanner/commit/1e45237dd235484a6a279f71ae7e126727382f9c)) +* Update opentelemetry.version to v1.36.0 ([#2945](https://github.com/googleapis/java-spanner/issues/2945)) ([e70b035](https://github.com/googleapis/java-spanner/commit/e70b0357543d38b6e9265e04444cec494ebd6885)) + + +### Documentation + +* **samples:** Add tag to statement timeout sample ([#2931](https://github.com/googleapis/java-spanner/issues/2931)) ([2392afe](https://github.com/googleapis/java-spanner/commit/2392afed0d25266294e0ce11c6ae32d7307e6830)) + ## [6.61.0](https://github.com/googleapis/java-spanner/compare/v6.60.1...v6.61.0) (2024-03-04) diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index 6749cc4c36f..2d4e4d671c0 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner-bom - 6.61.1-SNAPSHOT + 6.62.0 pom com.google.cloud @@ -53,43 +53,43 @@ com.google.cloud google-cloud-spanner - 6.61.1-SNAPSHOT + 6.62.0 com.google.cloud google-cloud-spanner test-jar - 6.61.1-SNAPSHOT + 6.62.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.61.1-SNAPSHOT + 6.62.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.61.1-SNAPSHOT + 6.62.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.61.1-SNAPSHOT + 6.62.0 com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.61.1-SNAPSHOT + 6.62.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.61.1-SNAPSHOT + 6.62.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.61.1-SNAPSHOT + 6.62.0 diff --git a/google-cloud-spanner-executor/pom.xml b/google-cloud-spanner-executor/pom.xml index 3aa9033e44a..2af05bd20b6 100644 --- a/google-cloud-spanner-executor/pom.xml +++ b/google-cloud-spanner-executor/pom.xml @@ -5,14 +5,14 @@ 4.0.0 com.google.cloud google-cloud-spanner-executor - 6.61.1-SNAPSHOT + 6.62.0 jar Google Cloud Spanner Executor com.google.cloud google-cloud-spanner-parent - 6.61.1-SNAPSHOT + 6.62.0 diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index e979331eed9..fbbfff73b94 100644 --- a/google-cloud-spanner/pom.xml +++ b/google-cloud-spanner/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner - 6.61.1-SNAPSHOT + 6.62.0 jar Google Cloud Spanner https://github.com/googleapis/java-spanner @@ -11,7 +11,7 @@ com.google.cloud google-cloud-spanner-parent - 6.61.1-SNAPSHOT + 6.62.0 google-cloud-spanner diff --git a/grpc-google-cloud-spanner-admin-database-v1/pom.xml b/grpc-google-cloud-spanner-admin-database-v1/pom.xml index 2bb8ac86b99..b872de0501c 100644 --- a/grpc-google-cloud-spanner-admin-database-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.61.1-SNAPSHOT + 6.62.0 grpc-google-cloud-spanner-admin-database-v1 GRPC library for grpc-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.61.1-SNAPSHOT + 6.62.0 diff --git a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml index c1a962d26fe..9d314eb7d23 100644 --- a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.61.1-SNAPSHOT + 6.62.0 grpc-google-cloud-spanner-admin-instance-v1 GRPC library for grpc-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.61.1-SNAPSHOT + 6.62.0 diff --git a/grpc-google-cloud-spanner-executor-v1/pom.xml b/grpc-google-cloud-spanner-executor-v1/pom.xml index b13409b4b71..a7275989cf5 100644 --- a/grpc-google-cloud-spanner-executor-v1/pom.xml +++ b/grpc-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.61.1-SNAPSHOT + 6.62.0 grpc-google-cloud-spanner-executor-v1 GRPC library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.61.1-SNAPSHOT + 6.62.0 diff --git a/grpc-google-cloud-spanner-v1/pom.xml b/grpc-google-cloud-spanner-v1/pom.xml index a61e657b209..b695c8da997 100644 --- a/grpc-google-cloud-spanner-v1/pom.xml +++ b/grpc-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.61.1-SNAPSHOT + 6.62.0 grpc-google-cloud-spanner-v1 GRPC library for grpc-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.61.1-SNAPSHOT + 6.62.0 diff --git a/pom.xml b/pom.xml index 57cccfdc43e..35a931f9ab8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-spanner-parent pom - 6.61.1-SNAPSHOT + 6.62.0 Google Cloud Spanner Parent https://github.com/googleapis/java-spanner @@ -61,47 +61,47 @@ com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.61.1-SNAPSHOT + 6.62.0 com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.61.1-SNAPSHOT + 6.62.0 com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.61.1-SNAPSHOT + 6.62.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.61.1-SNAPSHOT + 6.62.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.61.1-SNAPSHOT + 6.62.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.61.1-SNAPSHOT + 6.62.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.61.1-SNAPSHOT + 6.62.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.61.1-SNAPSHOT + 6.62.0 com.google.cloud google-cloud-spanner - 6.61.1-SNAPSHOT + 6.62.0 diff --git a/proto-google-cloud-spanner-admin-database-v1/pom.xml b/proto-google-cloud-spanner-admin-database-v1/pom.xml index a4d7bc4b1df..27270cdf927 100644 --- a/proto-google-cloud-spanner-admin-database-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.61.1-SNAPSHOT + 6.62.0 proto-google-cloud-spanner-admin-database-v1 PROTO library for proto-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.61.1-SNAPSHOT + 6.62.0 diff --git a/proto-google-cloud-spanner-admin-instance-v1/pom.xml b/proto-google-cloud-spanner-admin-instance-v1/pom.xml index 81d312af696..9b6fb006e07 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.61.1-SNAPSHOT + 6.62.0 proto-google-cloud-spanner-admin-instance-v1 PROTO library for proto-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.61.1-SNAPSHOT + 6.62.0 diff --git a/proto-google-cloud-spanner-executor-v1/pom.xml b/proto-google-cloud-spanner-executor-v1/pom.xml index 3c1163f2285..8d9ec1093db 100644 --- a/proto-google-cloud-spanner-executor-v1/pom.xml +++ b/proto-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.61.1-SNAPSHOT + 6.62.0 proto-google-cloud-spanner-executor-v1 Proto library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.61.1-SNAPSHOT + 6.62.0 diff --git a/proto-google-cloud-spanner-v1/pom.xml b/proto-google-cloud-spanner-v1/pom.xml index fef08e01a18..c27c59ffa9b 100644 --- a/proto-google-cloud-spanner-v1/pom.xml +++ b/proto-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.61.1-SNAPSHOT + 6.62.0 proto-google-cloud-spanner-v1 PROTO library for proto-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.61.1-SNAPSHOT + 6.62.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 6f0de936485..2df60939d2d 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -32,7 +32,7 @@ com.google.cloud google-cloud-spanner - 6.61.1-SNAPSHOT + 6.62.0 diff --git a/versions.txt b/versions.txt index 3ebf8d00374..0ebbb2abb0b 100644 --- a/versions.txt +++ b/versions.txt @@ -1,13 +1,13 @@ # Format: # module:released-version:current-version -proto-google-cloud-spanner-admin-instance-v1:6.61.0:6.61.1-SNAPSHOT -proto-google-cloud-spanner-v1:6.61.0:6.61.1-SNAPSHOT -proto-google-cloud-spanner-admin-database-v1:6.61.0:6.61.1-SNAPSHOT -grpc-google-cloud-spanner-v1:6.61.0:6.61.1-SNAPSHOT -grpc-google-cloud-spanner-admin-instance-v1:6.61.0:6.61.1-SNAPSHOT -grpc-google-cloud-spanner-admin-database-v1:6.61.0:6.61.1-SNAPSHOT -google-cloud-spanner:6.61.0:6.61.1-SNAPSHOT -google-cloud-spanner-executor:6.61.0:6.61.1-SNAPSHOT -proto-google-cloud-spanner-executor-v1:6.61.0:6.61.1-SNAPSHOT -grpc-google-cloud-spanner-executor-v1:6.61.0:6.61.1-SNAPSHOT +proto-google-cloud-spanner-admin-instance-v1:6.62.0:6.62.0 +proto-google-cloud-spanner-v1:6.62.0:6.62.0 +proto-google-cloud-spanner-admin-database-v1:6.62.0:6.62.0 +grpc-google-cloud-spanner-v1:6.62.0:6.62.0 +grpc-google-cloud-spanner-admin-instance-v1:6.62.0:6.62.0 +grpc-google-cloud-spanner-admin-database-v1:6.62.0:6.62.0 +google-cloud-spanner:6.62.0:6.62.0 +google-cloud-spanner-executor:6.62.0:6.62.0 +proto-google-cloud-spanner-executor-v1:6.62.0:6.62.0 +grpc-google-cloud-spanner-executor-v1:6.62.0:6.62.0 From bd82e0c591bb4ac1657b80c5c21d97b6aa989e5c Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 19 Mar 2024 13:02:16 +0000 Subject: [PATCH 18/47] chore(main): release 6.62.1-SNAPSHOT (#2957) :robot: I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please). --- google-cloud-spanner-bom/pom.xml | 18 ++++++++--------- google-cloud-spanner-executor/pom.xml | 4 ++-- google-cloud-spanner/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- grpc-google-cloud-spanner-executor-v1/pom.xml | 4 ++-- grpc-google-cloud-spanner-v1/pom.xml | 4 ++-- pom.xml | 20 +++++++++---------- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- proto-google-cloud-spanner-v1/pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 20 +++++++++---------- 14 files changed, 50 insertions(+), 50 deletions(-) diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index 2d4e4d671c0..552c09656aa 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner-bom - 6.62.0 + 6.62.1-SNAPSHOT pom com.google.cloud @@ -53,43 +53,43 @@ com.google.cloud google-cloud-spanner - 6.62.0 + 6.62.1-SNAPSHOT com.google.cloud google-cloud-spanner test-jar - 6.62.0 + 6.62.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.62.0 + 6.62.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.62.0 + 6.62.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.62.0 + 6.62.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.62.0 + 6.62.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-v1 - 6.62.0 + 6.62.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.62.0 + 6.62.1-SNAPSHOT diff --git a/google-cloud-spanner-executor/pom.xml b/google-cloud-spanner-executor/pom.xml index 2af05bd20b6..17fbe99ec0c 100644 --- a/google-cloud-spanner-executor/pom.xml +++ b/google-cloud-spanner-executor/pom.xml @@ -5,14 +5,14 @@ 4.0.0 com.google.cloud google-cloud-spanner-executor - 6.62.0 + 6.62.1-SNAPSHOT jar Google Cloud Spanner Executor com.google.cloud google-cloud-spanner-parent - 6.62.0 + 6.62.1-SNAPSHOT diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index fbbfff73b94..d393523667c 100644 --- a/google-cloud-spanner/pom.xml +++ b/google-cloud-spanner/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner - 6.62.0 + 6.62.1-SNAPSHOT jar Google Cloud Spanner https://github.com/googleapis/java-spanner @@ -11,7 +11,7 @@ com.google.cloud google-cloud-spanner-parent - 6.62.0 + 6.62.1-SNAPSHOT google-cloud-spanner diff --git a/grpc-google-cloud-spanner-admin-database-v1/pom.xml b/grpc-google-cloud-spanner-admin-database-v1/pom.xml index b872de0501c..2ca9a97a48e 100644 --- a/grpc-google-cloud-spanner-admin-database-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.62.0 + 6.62.1-SNAPSHOT grpc-google-cloud-spanner-admin-database-v1 GRPC library for grpc-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.62.0 + 6.62.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml index 9d314eb7d23..8c48c7f332d 100644 --- a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.62.0 + 6.62.1-SNAPSHOT grpc-google-cloud-spanner-admin-instance-v1 GRPC library for grpc-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.62.0 + 6.62.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-executor-v1/pom.xml b/grpc-google-cloud-spanner-executor-v1/pom.xml index a7275989cf5..ee648c3d8c3 100644 --- a/grpc-google-cloud-spanner-executor-v1/pom.xml +++ b/grpc-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.62.0 + 6.62.1-SNAPSHOT grpc-google-cloud-spanner-executor-v1 GRPC library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.62.0 + 6.62.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-v1/pom.xml b/grpc-google-cloud-spanner-v1/pom.xml index b695c8da997..de603820479 100644 --- a/grpc-google-cloud-spanner-v1/pom.xml +++ b/grpc-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.62.0 + 6.62.1-SNAPSHOT grpc-google-cloud-spanner-v1 GRPC library for grpc-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.62.0 + 6.62.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index 35a931f9ab8..3f727352edc 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-spanner-parent pom - 6.62.0 + 6.62.1-SNAPSHOT Google Cloud Spanner Parent https://github.com/googleapis/java-spanner @@ -61,47 +61,47 @@ com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.62.0 + 6.62.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.62.0 + 6.62.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.62.0 + 6.62.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-v1 - 6.62.0 + 6.62.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.62.0 + 6.62.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.62.0 + 6.62.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.62.0 + 6.62.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.62.0 + 6.62.1-SNAPSHOT com.google.cloud google-cloud-spanner - 6.62.0 + 6.62.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-admin-database-v1/pom.xml b/proto-google-cloud-spanner-admin-database-v1/pom.xml index 27270cdf927..056f74268d3 100644 --- a/proto-google-cloud-spanner-admin-database-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.62.0 + 6.62.1-SNAPSHOT proto-google-cloud-spanner-admin-database-v1 PROTO library for proto-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.62.0 + 6.62.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-admin-instance-v1/pom.xml b/proto-google-cloud-spanner-admin-instance-v1/pom.xml index 9b6fb006e07..69e2ace8786 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.62.0 + 6.62.1-SNAPSHOT proto-google-cloud-spanner-admin-instance-v1 PROTO library for proto-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.62.0 + 6.62.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-executor-v1/pom.xml b/proto-google-cloud-spanner-executor-v1/pom.xml index 8d9ec1093db..91283ecb9e4 100644 --- a/proto-google-cloud-spanner-executor-v1/pom.xml +++ b/proto-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.62.0 + 6.62.1-SNAPSHOT proto-google-cloud-spanner-executor-v1 Proto library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.62.0 + 6.62.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-v1/pom.xml b/proto-google-cloud-spanner-v1/pom.xml index c27c59ffa9b..ceb83bde59e 100644 --- a/proto-google-cloud-spanner-v1/pom.xml +++ b/proto-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.62.0 + 6.62.1-SNAPSHOT proto-google-cloud-spanner-v1 PROTO library for proto-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.62.0 + 6.62.1-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 2df60939d2d..11efd20a47c 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -32,7 +32,7 @@ com.google.cloud google-cloud-spanner - 6.62.0 + 6.62.1-SNAPSHOT diff --git a/versions.txt b/versions.txt index 0ebbb2abb0b..79dd5517204 100644 --- a/versions.txt +++ b/versions.txt @@ -1,13 +1,13 @@ # Format: # module:released-version:current-version -proto-google-cloud-spanner-admin-instance-v1:6.62.0:6.62.0 -proto-google-cloud-spanner-v1:6.62.0:6.62.0 -proto-google-cloud-spanner-admin-database-v1:6.62.0:6.62.0 -grpc-google-cloud-spanner-v1:6.62.0:6.62.0 -grpc-google-cloud-spanner-admin-instance-v1:6.62.0:6.62.0 -grpc-google-cloud-spanner-admin-database-v1:6.62.0:6.62.0 -google-cloud-spanner:6.62.0:6.62.0 -google-cloud-spanner-executor:6.62.0:6.62.0 -proto-google-cloud-spanner-executor-v1:6.62.0:6.62.0 -grpc-google-cloud-spanner-executor-v1:6.62.0:6.62.0 +proto-google-cloud-spanner-admin-instance-v1:6.62.0:6.62.1-SNAPSHOT +proto-google-cloud-spanner-v1:6.62.0:6.62.1-SNAPSHOT +proto-google-cloud-spanner-admin-database-v1:6.62.0:6.62.1-SNAPSHOT +grpc-google-cloud-spanner-v1:6.62.0:6.62.1-SNAPSHOT +grpc-google-cloud-spanner-admin-instance-v1:6.62.0:6.62.1-SNAPSHOT +grpc-google-cloud-spanner-admin-database-v1:6.62.0:6.62.1-SNAPSHOT +google-cloud-spanner:6.62.0:6.62.1-SNAPSHOT +google-cloud-spanner-executor:6.62.0:6.62.1-SNAPSHOT +proto-google-cloud-spanner-executor-v1:6.62.0:6.62.1-SNAPSHOT +grpc-google-cloud-spanner-executor-v1:6.62.0:6.62.1-SNAPSHOT From a0a2e8d753a84515a0c3b2a6cf39e41da8c52f58 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 20 Mar 2024 15:17:35 +0100 Subject: [PATCH 19/47] chore(deps): update dependency com.google.cloud:google-cloud-spanner to v6.62.0 (#2958) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update dependency com.google.cloud:google-cloud-spanner to v6.62.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- README.md | 2 +- samples/install-without-bom/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b8fd2f3be7c..56d91c89705 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ If you are using Maven without the BOM, add this to your dependencies: com.google.cloud google-cloud-spanner - 6.61.0 + 6.62.0 ``` diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 143fe8d00bc..123d1566867 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -33,7 +33,7 @@ com.google.cloud google-cloud-spanner - 6.61.0 + 6.62.0 From eaa05daf5c272609e4fb6ad0f1bc09148edf1fe9 Mon Sep 17 00:00:00 2001 From: Arpan Mishra Date: Fri, 22 Mar 2024 09:58:04 +0530 Subject: [PATCH 20/47] chore: add session pool options for multiplexed session. (#2960) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: prevent illegal negative timeout values into thread sleep() method while retrying exceptions in unit tests. * For details on issue see - https://github.com/googleapis/java-spanner/issues/2206 * Fixing lint issues. * chore: add session pool options for multiplexed session. * Update google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java Co-authored-by: Knut Olav Løite * Update google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java Co-authored-by: Knut Olav Løite * fix: comments. * chore: lint fix. --------- Co-authored-by: Knut Olav Løite --- .../cloud/spanner/SessionPoolOptions.java | 74 ++++++++++++++++++- .../cloud/spanner/SessionPoolOptionsTest.java | 58 +++++++++++++++ 2 files changed, 130 insertions(+), 2 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java index 2ebe77e1ba2..92b1baacc03 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java @@ -69,6 +69,10 @@ public class SessionPoolOptions { /** Property for allowing mocking of session maintenance clock. */ private final Clock poolMaintainerClock; + private final Duration waitForMultiplexedSession; + private final boolean useMultiplexedSession; + private final Duration multiplexedSessionMaintenanceDuration; + private SessionPoolOptions(Builder builder) { // minSessions > maxSessions is only possible if the user has only set a value for maxSessions. // We allow that to prevent code that only sets a value for maxSessions to break if the @@ -93,6 +97,9 @@ private SessionPoolOptions(Builder builder) { this.randomizePositionQPSThreshold = builder.randomizePositionQPSThreshold; this.inactiveTransactionRemovalOptions = builder.inactiveTransactionRemovalOptions; this.poolMaintainerClock = builder.poolMaintainerClock; + this.useMultiplexedSession = builder.useMultiplexedSession; + this.multiplexedSessionMaintenanceDuration = builder.multiplexedSessionMaintenanceDuration; + this.waitForMultiplexedSession = builder.waitForMultiplexedSession; } @Override @@ -123,7 +130,11 @@ public boolean equals(Object o) { && Objects.equals(this.randomizePositionQPSThreshold, other.randomizePositionQPSThreshold) && Objects.equals( this.inactiveTransactionRemovalOptions, other.inactiveTransactionRemovalOptions) - && Objects.equals(this.poolMaintainerClock, other.poolMaintainerClock); + && Objects.equals(this.poolMaintainerClock, other.poolMaintainerClock) + && Objects.equals(this.useMultiplexedSession, other.useMultiplexedSession) + && Objects.equals( + this.multiplexedSessionMaintenanceDuration, other.multiplexedSessionMaintenanceDuration) + && Objects.equals(this.waitForMultiplexedSession, other.waitForMultiplexedSession); } @Override @@ -148,7 +159,10 @@ public int hashCode() { this.releaseToPosition, this.randomizePositionQPSThreshold, this.inactiveTransactionRemovalOptions, - this.poolMaintainerClock); + this.poolMaintainerClock, + this.useMultiplexedSession, + this.multiplexedSessionMaintenanceDuration, + this.waitForMultiplexedSession); } public Builder toBuilder() { @@ -271,6 +285,18 @@ long getRandomizePositionQPSThreshold() { return randomizePositionQPSThreshold; } + boolean getUseMultiplexedSession() { + return useMultiplexedSession; + } + + Duration getMultiplexedSessionMaintenanceDuration() { + return multiplexedSessionMaintenanceDuration; + } + + Duration getWaitForMultiplexedSession() { + return waitForMultiplexedSession; + } + public static Builder newBuilder() { return new Builder(); } @@ -467,6 +493,9 @@ public static class Builder { */ private long randomizePositionQPSThreshold = 0L; + private boolean useMultiplexedSession = false; + private Duration multiplexedSessionMaintenanceDuration = Duration.ofDays(7); + private Duration waitForMultiplexedSession = Duration.ofSeconds(10); private Clock poolMaintainerClock; private static Position getReleaseToPositionFromSystemProperty() { @@ -669,6 +698,47 @@ Builder setPoolMaintainerClock(Clock poolMaintainerClock) { return this; } + /** + * Sets whether the client should use multiplexed session or not. If set to true, the client + * optimises and runs multiple applicable requests concurrently on a single session. A single + * multiplexed session is sufficient to handle all concurrent traffic. + * + *

    When set to false, the client uses the regular session cached in the session pool for + * running 1 concurrent transaction per session. We require to provision sufficient sessions by + * making use of {@link SessionPoolOptions#minSessions} and {@link + * SessionPoolOptions#maxSessions} based on the traffic load. Failing to do so will result in + * higher latencies. + */ + Builder setUseMultiplexedSession(boolean useMultiplexedSession) { + this.useMultiplexedSession = useMultiplexedSession; + return this; + } + + @VisibleForTesting + Builder setMultiplexedSessionMaintenanceDuration( + Duration multiplexedSessionMaintenanceDuration) { + this.multiplexedSessionMaintenanceDuration = multiplexedSessionMaintenanceDuration; + return this; + } + + /** + * This option is only used when {@link SessionPoolOptions#useMultiplexedSession} is set to + * true. If greater than zero, calls to {@link Spanner#getDatabaseClient(DatabaseId)} will block + * for up to the given duration while waiting for the multiplexed session to be created. The + * default value for this is 10 seconds. + * + *

    If this is set to null or zero, the client does not wait for the session to be created, + * which means that the first read requests could see more latency, as they will need to wait + * until the multiplexed session has been created. + * + *

    Note that we would need to use the option {@link SessionPoolOptions#waitForMinSessions} if + * we want a similar blocking behavior for the other sessions within the session pool. + */ + Builder setWaitForMultiplexedSession(Duration waitForMultiplexedSession) { + this.waitForMultiplexedSession = waitForMultiplexedSession; + return this; + } + /** * Sets whether the client should automatically execute a background query to detect the dialect * that is used by the database or not. Set this option to true if you do not know what the diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolOptionsTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolOptionsTest.java index 22d10d92a87..9e029e931d6 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolOptionsTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolOptionsTest.java @@ -246,4 +246,62 @@ public void testRandomizePositionQPSThreshold() { IllegalArgumentException.class, () -> SessionPoolOptions.newBuilder().setRandomizePositionQPSThreshold(-1L)); } + + @Test + public void testUseMultiplexedSession() { + assertEquals(false, SessionPoolOptions.newBuilder().build().getUseMultiplexedSession()); + assertEquals( + true, + SessionPoolOptions.newBuilder() + .setUseMultiplexedSession(true) + .build() + .getUseMultiplexedSession()); + assertEquals( + false, + SessionPoolOptions.newBuilder() + .setUseMultiplexedSession(true) + .setUseMultiplexedSession(false) + .build() + .getUseMultiplexedSession()); + } + + @Test + public void testMultiplexedSessionMaintenanceDuration() { + assertEquals( + Duration.ofDays(7), + SessionPoolOptions.newBuilder().build().getMultiplexedSessionMaintenanceDuration()); + assertEquals( + Duration.ofDays(2), + SessionPoolOptions.newBuilder() + .setMultiplexedSessionMaintenanceDuration(Duration.ofDays(2)) + .build() + .getMultiplexedSessionMaintenanceDuration()); + assertEquals( + Duration.ofDays(10), + SessionPoolOptions.newBuilder() + .setMultiplexedSessionMaintenanceDuration(Duration.ofDays(2)) + .setMultiplexedSessionMaintenanceDuration(Duration.ofDays(10)) + .build() + .getMultiplexedSessionMaintenanceDuration()); + } + + @Test + public void testWaitForMultiplexedSession() { + assertEquals( + Duration.ofSeconds(10), + SessionPoolOptions.newBuilder().build().getWaitForMultiplexedSession()); + assertEquals( + Duration.ofSeconds(20), + SessionPoolOptions.newBuilder() + .setWaitForMultiplexedSession(Duration.ofSeconds(20)) + .build() + .getWaitForMultiplexedSession()); + assertEquals( + Duration.ofSeconds(10), + SessionPoolOptions.newBuilder() + .setWaitForMultiplexedSession(Duration.ofSeconds(2)) + .setWaitForMultiplexedSession(Duration.ofSeconds(10)) + .build() + .getWaitForMultiplexedSession()); + } } From 8e4ee0361ece395701687786a942c07a61ef8ba7 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Sun, 24 Mar 2024 08:28:51 +0100 Subject: [PATCH 21/47] deps: update dependency com.google.cloud:google-cloud-trace to v2.38.0 (#2967) --- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 123d1566867..49c59dcb6f1 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -23,7 +23,7 @@ 1.8 UTF-8 0.31.1 - 2.37.0 + 2.38.0 3.38.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 11efd20a47c..1f58eb127a4 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -23,7 +23,7 @@ 1.8 UTF-8 0.31.1 - 2.37.0 + 2.38.0 3.38.0 From ebf872361dd53a87de600328577acd944d7cd180 Mon Sep 17 00:00:00 2001 From: Arpan Mishra Date: Sun, 24 Mar 2024 16:50:59 +0530 Subject: [PATCH 22/47] =?UTF-8?q?chore:=20add=20new=20members=20in=20Sessi?= =?UTF-8?q?onImpl=20for=20multiplexed=20session.=20Add=20a=20=E2=80=A6=20(?= =?UTF-8?q?#2961)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: add new members in SessionImpl for multiplexed session. Add a new method to create multiplexed session. * chore: add unit tests. * Update google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionClient.java Co-authored-by: Knut Olav Løite * fix: comments. * chore: prefer junit assertions. * chore: change to default method in SpannerRpc interface. --------- Co-authored-by: Knut Olav Løite --- .../google/cloud/spanner/SessionClient.java | 44 ++++++++++- .../com/google/cloud/spanner/SessionImpl.java | 35 ++++++++ .../com/google/cloud/spanner/SpannerImpl.java | 1 + .../cloud/spanner/spi/v1/GapicSpannerRpc.java | 13 +++ .../cloud/spanner/spi/v1/SpannerRpc.java | 10 +++ .../cloud/spanner/MockSpannerServiceImpl.java | 3 + .../cloud/spanner/SessionClientTests.java | 79 +++++++++++++++++++ .../google/cloud/spanner/SessionImplTest.java | 1 - .../spanner/spi/v1/GapicSpannerRpcTest.java | 37 +++++++++ 9 files changed, 220 insertions(+), 3 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionClient.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionClient.java index b294ef33395..f3723618b9e 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionClient.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionClient.java @@ -215,7 +215,8 @@ SessionImpl createSession() { spanner.getOptions().getDatabaseRole(), spanner.getOptions().getSessionLabels(), options); - return new SessionImpl(spanner, session.getName(), options); + return new SessionImpl( + spanner, session.getName(), session.getCreateTime(), session.getMultiplexed(), options); } catch (RuntimeException e) { span.setStatus(e); throw e; @@ -224,6 +225,39 @@ SessionImpl createSession() { } } + /** + * Create a multiplexed session and returns it to the given {@link SessionConsumer}. A multiplexed + * session is not affiliated with any GRPC channel. The given {@link SessionConsumer} is + * guaranteed to eventually get exactly 1 multiplexed session unless an error occurs. In case of + * an error on the gRPC calls, the consumer will receive one {@link + * SessionConsumer#onSessionCreateFailure(Throwable, int)} calls with the error. + * + * @param consumer The {@link SessionConsumer} to use for callbacks when sessions are available. + */ + void createMultiplexedSession(SessionConsumer consumer) { + ISpan span = spanner.getTracer().spanBuilder(SpannerImpl.CREATE_MULTIPLEXED_SESSION); + try (IScope s = spanner.getTracer().withSpan(span)) { + com.google.spanner.v1.Session session = + spanner + .getRpc() + .createSession( + db.getName(), + spanner.getOptions().getDatabaseRole(), + spanner.getOptions().getSessionLabels(), + null, + true); + SessionImpl sessionImpl = + new SessionImpl( + spanner, session.getName(), session.getCreateTime(), session.getMultiplexed(), null); + consumer.onSessionReady(sessionImpl); + } catch (Throwable t) { + span.setStatus(t); + consumer.onSessionCreateFailure(t, 1); + } finally { + span.end(); + } + } + /** * Asynchronously creates a batch of sessions and returns these to the given {@link * SessionConsumer}. This method may split the actual session creation over several gRPC calls in @@ -311,7 +345,13 @@ private List internalBatchCreateSessions( span.end(); List res = new ArrayList<>(sessionCount); for (com.google.spanner.v1.Session session : sessions) { - res.add(new SessionImpl(spanner, session.getName(), options)); + res.add( + new SessionImpl( + spanner, + session.getName(), + session.getCreateTime(), + session.getMultiplexed(), + options)); } return res; } catch (RuntimeException e) { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java index 81b00001105..bea44abab3e 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java @@ -98,6 +98,8 @@ interface SessionTransaction { ByteString readyTransactionId; private final Map options; private volatile Instant lastUseTime; + @Nullable private final Instant createTime; + private final boolean isMultiplexed; private ISpan currentSpan; SessionImpl(SpannerImpl spanner, String name, Map options) { @@ -107,6 +109,24 @@ interface SessionTransaction { this.name = checkNotNull(name); this.databaseId = SessionId.of(name).getDatabaseId(); this.lastUseTime = Instant.now(); + this.createTime = null; + this.isMultiplexed = false; + } + + SessionImpl( + SpannerImpl spanner, + String name, + com.google.protobuf.Timestamp createTime, + boolean isMultiplexed, + Map options) { + this.spanner = spanner; + this.tracer = spanner.getTracer(); + this.options = options; + this.name = checkNotNull(name); + this.databaseId = SessionId.of(name).getDatabaseId(); + this.lastUseTime = Instant.now(); + this.createTime = convert(createTime); + this.isMultiplexed = isMultiplexed; } @Override @@ -130,6 +150,14 @@ Instant getLastUseTime() { return lastUseTime; } + Instant getCreateTime() { + return createTime; + } + + boolean getIsMultiplexed() { + return isMultiplexed; + } + void markUsed(Instant instant) { lastUseTime = instant; } @@ -455,4 +483,11 @@ boolean hasReadyTransaction() { TraceWrapper getTracer() { return tracer; } + + private Instant convert(com.google.protobuf.Timestamp timestamp) { + if (timestamp == null) { + return null; + } + return Instant.ofEpochSecond(timestamp.getSeconds(), timestamp.getNanos()); + } } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerImpl.java index 2ab75d74174..69c8be9a706 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerImpl.java @@ -68,6 +68,7 @@ class SpannerImpl extends BaseService implements Spanner { MetricRegistryConstants.INSTRUMENTATION_SCOPE, GaxProperties.getLibraryVersion(this.getOptions().getClass()))); + static final String CREATE_MULTIPLEXED_SESSION = "CloudSpannerOperation.CreateMultiplexedSession"; static final String CREATE_SESSION = "CloudSpannerOperation.CreateSession"; static final String BATCH_CREATE_SESSIONS = "CloudSpannerOperation.BatchCreateSessions"; static final String BATCH_CREATE_SESSIONS_REQUEST = diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java index 29de1fe1ff5..8974c4287bb 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java @@ -1605,6 +1605,18 @@ public Session createSession( @Nullable Map labels, @Nullable Map options) throws SpannerException { + // By default sessions are not multiplexed + return createSession(databaseName, databaseRole, labels, options, false); + } + + @Override + public Session createSession( + String databaseName, + @Nullable String databaseRole, + @Nullable Map labels, + @Nullable Map options, + boolean isMultiplexed) + throws SpannerException { CreateSessionRequest.Builder requestBuilder = CreateSessionRequest.newBuilder().setDatabase(databaseName); Session.Builder sessionBuilder = Session.newBuilder(); @@ -1614,6 +1626,7 @@ public Session createSession( if (databaseRole != null && !databaseRole.isEmpty()) { sessionBuilder.setCreatorRole(databaseRole); } + sessionBuilder.setMultiplexed(isMultiplexed); requestBuilder.setSession(sessionBuilder); CreateSessionRequest request = requestBuilder.build(); GrpcCallContext context = diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/SpannerRpc.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/SpannerRpc.java index 7868f3ec099..f063a7a3138 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/SpannerRpc.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/SpannerRpc.java @@ -340,6 +340,16 @@ Session createSession( @Nullable Map options) throws SpannerException; + default Session createSession( + String databaseName, + @Nullable String databaseRole, + @Nullable Map labels, + @Nullable Map options, + boolean isMultiplexed) + throws SpannerException { + throw new UnsupportedOperationException("Unimplemented"); + } + void deleteSession(String sessionName, @Nullable Map options) throws SpannerException; ApiFuture asyncDeleteSession(String sessionName, @Nullable Map options) diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MockSpannerServiceImpl.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MockSpannerServiceImpl.java index 7073ebd28e8..18973bd2d9d 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MockSpannerServiceImpl.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MockSpannerServiceImpl.java @@ -858,7 +858,9 @@ public void createSession( CreateSessionRequest request, StreamObserver responseObserver) { requests.add(request); Preconditions.checkNotNull(request.getDatabase()); + Preconditions.checkNotNull(request.getSession()); String name = generateSessionName(request.getDatabase()); + Session requestSession = request.getSession(); try { createSessionExecutionTime.simulateExecutionTime( exceptions, stickyGlobalExceptions, freezeLock); @@ -868,6 +870,7 @@ public void createSession( .setCreateTime(now) .setName(name) .setApproximateLastUseTime(now) + .setMultiplexed(requestSession.getMultiplexed()) .build(); Session prev = sessions.putIfAbsent(name, session); if (prev == null) { diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionClientTests.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionClientTests.java index c8d9bc39339..3094282f07b 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionClientTests.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionClientTests.java @@ -17,6 +17,9 @@ package com.google.cloud.spanner; import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; @@ -29,6 +32,7 @@ import com.google.cloud.spanner.SessionClient.SessionConsumer; import com.google.cloud.spanner.spi.v1.SpannerRpc; import com.google.cloud.spanner.spi.v1.SpannerRpc.Option; +import com.google.common.collect.ImmutableMap; import io.opencensus.trace.Tracing; import io.opentelemetry.api.OpenTelemetry; import java.util.ArrayList; @@ -151,6 +155,81 @@ public void createAndCloseSession() { } } + @Test + public void createAndCloseMultiplexedSession() { + DatabaseId db = DatabaseId.of(dbName); + String sessionName = dbName + "/sessions/s1"; + Map labels = ImmutableMap.of("env", "dev"); + String databaseRole = "role"; + when(spannerOptions.getSessionLabels()).thenReturn(labels); + when(spannerOptions.getDatabaseRole()).thenReturn(databaseRole); + com.google.spanner.v1.Session sessionProto = + com.google.spanner.v1.Session.newBuilder() + .setName(sessionName) + .setMultiplexed(true) + .putAllLabels(labels) + .build(); + when(rpc.createSession( + Mockito.eq(dbName), + Mockito.eq(databaseRole), + Mockito.eq(labels), + options.capture(), + Mockito.eq(true))) + .thenReturn(sessionProto); + final AtomicInteger returnedSessionCount = new AtomicInteger(); + final SessionConsumer consumer = + new SessionConsumer() { + @Override + public void onSessionReady(SessionImpl session) { + assertEquals(sessionName, session.getName()); + returnedSessionCount.incrementAndGet(); + + session.close(); + Mockito.verify(rpc).deleteSession(sessionName, options.getValue()); + } + + @Override + public void onSessionCreateFailure(Throwable t, int createFailureForSessionCount) {} + }; + try (SessionClient client = new SessionClient(spanner, db, new TestExecutorFactory())) { + client.createMultiplexedSession(consumer); + } + // for multiplexed session there is no channel hint pass in the RPC options + assertNull(options.getValue()); + assertEquals(1, returnedSessionCount.get()); + } + + @Test + public void createAndCloseMultiplexedSession_whenRPCThrowsException_thenAssertException() { + DatabaseId db = DatabaseId.of(dbName); + Map labels = ImmutableMap.of("env", "dev"); + String databaseRole = "role"; + when(spannerOptions.getSessionLabels()).thenReturn(labels); + when(spannerOptions.getDatabaseRole()).thenReturn(databaseRole); + when(rpc.createSession( + Mockito.eq(dbName), + Mockito.eq(databaseRole), + Mockito.eq(labels), + options.capture(), + Mockito.eq(true))) + .thenThrow(RuntimeException.class); + final SessionConsumer consumer = + new SessionConsumer() { + @Override + public void onSessionReady(SessionImpl session) {} + + @Override + public void onSessionCreateFailure(Throwable t, int createFailureForSessionCount) { + assertTrue(t instanceof RuntimeException); + } + }; + try (SessionClient client = new SessionClient(spanner, db, new TestExecutorFactory())) { + client.createMultiplexedSession(consumer); + } + // for multiplexed session there is no channel hint pass in the RPC options + assertNull(options.getValue()); + } + @SuppressWarnings("unchecked") @Test public void batchCreateAndCloseSessions() { diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionImplTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionImplTest.java index 87edb64134c..ff50bf52e70 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionImplTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionImplTest.java @@ -22,7 +22,6 @@ import static org.junit.Assert.assertThrows; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpcTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpcTest.java index fb139dc89d7..42a07ed9ea6 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpcTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpcTest.java @@ -57,6 +57,7 @@ import com.google.spanner.v1.ExecuteSqlRequest; import com.google.spanner.v1.GetSessionRequest; import com.google.spanner.v1.ResultSetMetadata; +import com.google.spanner.v1.Session; import com.google.spanner.v1.SpannerGrpc; import com.google.spanner.v1.StructType; import com.google.spanner.v1.StructType.Field; @@ -668,6 +669,42 @@ public void testAdminStubSettings_whenStubNotInitialized_assertNullClientSetting rpc.shutdown(); } + @Test + public void testCreateSession_assertSessionProto() { + SpannerOptions options = createSpannerOptions(); + GapicSpannerRpc rpc = new GapicSpannerRpc(options, true); + + Session session = rpc.createSession("DATABASE_NAME", null, null, null); + assertNotNull(session); + assertNotNull(session.getCreateTime()); + assertEquals(false, session.getMultiplexed()); + rpc.shutdown(); + } + + @Test + public void testCreateSession_whenMultiplexedSessionIsTrue_assertSessionProto() { + SpannerOptions options = createSpannerOptions(); + GapicSpannerRpc rpc = new GapicSpannerRpc(options, true); + + Session session = rpc.createSession("DATABASE_NAME", null, null, null, true); + assertNotNull(session); + assertNotNull(session.getCreateTime()); + assertEquals(true, session.getMultiplexed()); + rpc.shutdown(); + } + + @Test + public void testCreateSession_whenMultiplexedSessionIsFalse_assertSessionProto() { + SpannerOptions options = createSpannerOptions(); + GapicSpannerRpc rpc = new GapicSpannerRpc(options, true); + + Session session = rpc.createSession("DATABASE_NAME", null, null, null, false); + assertNotNull(session); + assertNotNull(session.getCreateTime()); + assertEquals(false, session.getMultiplexed()); + rpc.shutdown(); + } + private SpannerOptions createSpannerOptions() { String endpoint = address.getHostString() + ":" + server.getPort(); return SpannerOptions.newBuilder() From 358e8d39236c0cfba7f52fba7bec7ef2deb79ad8 Mon Sep 17 00:00:00 2001 From: Quynh Tran Date: Mon, 25 Mar 2024 12:11:41 +1100 Subject: [PATCH 23/47] Update .gitignore to remove IDE specific files and remove unnecessary entries from CLIRR ignores --- .gitignore | 2 ++ .java-version | 1 - .vscode/settings.json | 4 ---- .../clirr-ignored-differences.xml | 15 --------------- .../cloud/spanner/AbstractStructReader.java | 12 +++++++++--- 5 files changed, 11 insertions(+), 23 deletions(-) delete mode 100644 .java-version delete mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 0141aa5d4c8..23d4fe55083 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ docs/ *.pyc .flattened-pom.xml +.java-version +.vscode/ diff --git a/.java-version b/.java-version deleted file mode 100644 index e000eb89469..00000000000 --- a/.java-version +++ /dev/null @@ -1 +0,0 @@ -17.0.9 diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index c4f2897d364..00000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable", - "java.compile.nullAnalysis.mode": "automatic" -} \ No newline at end of file diff --git a/google-cloud-spanner/clirr-ignored-differences.xml b/google-cloud-spanner/clirr-ignored-differences.xml index 3abdcab49b3..95a38dae424 100644 --- a/google-cloud-spanner/clirr-ignored-differences.xml +++ b/google-cloud-spanner/clirr-ignored-differences.xml @@ -193,21 +193,6 @@ java.util.List getPgJsonbList(java.lang.String) - - 7013 - com/google/cloud/spanner/AbstractStructReader - long[] getPgOidArrayInternal(int) - - - 7013 - com/google/cloud/spanner/AbstractStructReader - long getPgOidInternal(int) - - - 7013 - com/google/cloud/spanner/AbstractStructReader - java.util.List getPgOidListInternal(int) - 7012 com/google/cloud/spanner/StructReader diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java index de68e9b75ad..47a2f34d3f7 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java @@ -61,7 +61,9 @@ protected String getPgJsonbInternal(int columnIndex) { throw new UnsupportedOperationException("Not implemented"); } - protected abstract long getPgOidInternal(int columnIndex); + protected abstract long getPgOidInternal(int columnIndex) { + throw new UnsupportedOperationException("Not implemented"); + } protected abstract ByteArray getBytesInternal(int columnIndex); @@ -124,9 +126,13 @@ protected List getPgJsonbListInternal(int columnIndex) { throw new UnsupportedOperationException("Not implemented"); } - protected abstract long[] getPgOidArrayInternal(int columnIndex); + protected abstract long[] getPgOidArrayInternal(int columnIndex) { + throw new UnsupportedOperationException("Not implemented"); + } - protected abstract List getPgOidListInternal(int columnIndex); + protected abstract List getPgOidListInternal(int columnIndex) { + throw new UnsupportedOperationException("Not implemented"); + } protected abstract List getBytesListInternal(int columnIndex); From 1e993103d1ae09b0657097e5b6da8bbbefb194de Mon Sep 17 00:00:00 2001 From: Quynh Tran Date: Mon, 25 Mar 2024 17:40:54 +1100 Subject: [PATCH 24/47] Remove PG.OID external getters. User should use Long/LongArray/LongList getters instead to get PgOid/PgOidArray/PgOidList columns. --- .../cloud/spanner/AbstractResultSet.java | 25 ------ .../cloud/spanner/AbstractStructReader.java | 86 +++++++------------ .../cloud/spanner/ForwardingStructReader.java | 35 -------- .../com/google/cloud/spanner/GrpcStruct.java | 12 ++- .../com/google/cloud/spanner/ResultSets.java | 30 ------- .../java/com/google/cloud/spanner/Struct.java | 6 +- .../google/cloud/spanner/StructReader.java | 56 ------------ .../java/com/google/cloud/spanner/Value.java | 4 +- .../connection/DirectExecuteResultSet.java | 36 -------- .../ReplaceableForwardingResultSet.java | 36 -------- .../AbstractStructReaderTypesTest.java | 17 ++-- .../cloud/spanner/GrpcResultSetTest.java | 6 +- .../google/cloud/spanner/ResultSetsTest.java | 10 +-- .../connection/AllTypesMockServerTest.java | 4 +- .../DirectExecuteResultSetTest.java | 13 --- .../google/cloud/spanner/it/ITQueryTest.java | 2 +- 16 files changed, 62 insertions(+), 316 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java index 73233b41820..cfb9856b117 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java @@ -342,31 +342,6 @@ Double get(double[] array, int i) { } } - static class PgOidArray extends PrimitiveArray { - PgOidArray(ListValue protoList) { - super(protoList); - } - - PgOidArray(long[] data, BitSet nulls) { - super(data, nulls, data.length); - } - - @Override - long[] newArray(int size) { - return new long[size]; - } - - @Override - void setProto(long[] array, int i, com.google.protobuf.Value protoValue) { - array[i] = Long.parseLong(protoValue.getStringValue()); - } - - @Override - Long get(long[] array, int i) { - return array[i]; - } - } - protected abstract GrpcStruct currRow(); @Override diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java index 47a2f34d3f7..e6a29b1805f 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java @@ -61,7 +61,7 @@ protected String getPgJsonbInternal(int columnIndex) { throw new UnsupportedOperationException("Not implemented"); } - protected abstract long getPgOidInternal(int columnIndex) { + protected long getPgOidInternal(int columnIndex) { throw new UnsupportedOperationException("Not implemented"); } @@ -126,11 +126,11 @@ protected List getPgJsonbListInternal(int columnIndex) { throw new UnsupportedOperationException("Not implemented"); } - protected abstract long[] getPgOidArrayInternal(int columnIndex) { + protected long[] getPgOidArrayInternal(int columnIndex) { throw new UnsupportedOperationException("Not implemented"); } - protected abstract List getPgOidListInternal(int columnIndex) { + protected List getPgOidListInternal(int columnIndex) { throw new UnsupportedOperationException("Not implemented"); } @@ -177,15 +177,20 @@ public boolean getBoolean(String columnName) { @Override public long getLong(int columnIndex) { - checkNonNullOfCodes(columnIndex, Arrays.asList(Code.ENUM, Code.INT64), columnIndex); - return getLongInternal(columnIndex); + checkNonNullOfCodes( + columnIndex, Arrays.asList(Code.ENUM, Code.PG_OID, Code.INT64), columnIndex); + return getColumnType(columnIndex).getCode() == Code.PG_OID + ? getPgOidInternal(columnIndex) + : getLongInternal(columnIndex); } @Override public long getLong(String columnName) { int columnIndex = getColumnIndex(columnName); - checkNonNullOfCodes(columnIndex, Arrays.asList(Code.ENUM, Code.INT64), columnName); - return getLongInternal(columnIndex); + checkNonNullOfCodes(columnIndex, Arrays.asList(Code.ENUM, Code.PG_OID, Code.INT64), columnName); + return getColumnType(columnIndex).getCode() == Code.PG_OID + ? getPgOidInternal(columnIndex) + : getLongInternal(columnIndex); } @Override @@ -271,19 +276,6 @@ public String getPgJsonb(String columnName) { return getPgJsonbInternal(columnIndex); } - @Override - public long getPgOid(int columnIndex) { - checkNonNullOfType(columnIndex, Type.pgOid(), columnIndex); - return getPgOidInternal(columnIndex); - } - - @Override - public long getPgOid(String columnName) { - int columnIndex = getColumnIndex(columnName); - checkNonNullOfType(columnIndex, Type.pgOid(), columnName); - return getPgOidInternal(columnIndex); - } - @Override public ByteArray getBytes(int columnIndex) { checkNonNullOfCodes(columnIndex, Arrays.asList(Code.PROTO, Code.BYTES), columnIndex); @@ -391,31 +383,43 @@ public List getBooleanList(String columnName) { @Override public long[] getLongArray(int columnIndex) { checkNonNullOfCodes(columnIndex, Collections.singletonList(Code.ARRAY), columnIndex); - checkArrayElementType(columnIndex, Arrays.asList(Code.ENUM, Code.INT64), columnIndex); - return getLongArrayInternal(columnIndex); + checkArrayElementType( + columnIndex, Arrays.asList(Code.ENUM, Code.PG_OID, Code.INT64), columnIndex); + return getColumnType(columnIndex).getArrayElementType().getCode() == Code.PG_OID + ? getPgOidArrayInternal(columnIndex) + : getLongArrayInternal(columnIndex); } @Override public long[] getLongArray(String columnName) { int columnIndex = getColumnIndex(columnName); checkNonNullOfCodes(columnIndex, Collections.singletonList(Code.ARRAY), columnName); - checkArrayElementType(columnIndex, Arrays.asList(Code.ENUM, Code.INT64), columnName); - return getLongArrayInternal(columnIndex); + checkArrayElementType( + columnIndex, Arrays.asList(Code.ENUM, Code.PG_OID, Code.INT64), columnName); + return getColumnType(columnIndex).getArrayElementType().getCode() == Code.PG_OID + ? getPgOidArrayInternal(columnIndex) + : getLongArrayInternal(columnIndex); } @Override public List getLongList(int columnIndex) { checkNonNullOfCodes(columnIndex, Collections.singletonList(Code.ARRAY), columnIndex); - checkArrayElementType(columnIndex, Arrays.asList(Code.ENUM, Code.INT64), columnIndex); - return getLongListInternal(columnIndex); + checkArrayElementType( + columnIndex, Arrays.asList(Code.ENUM, Code.PG_OID, Code.INT64), columnIndex); + return getColumnType(columnIndex).getArrayElementType().getCode() == Code.PG_OID + ? getPgOidListInternal(columnIndex) + : getLongListInternal(columnIndex); } @Override public List getLongList(String columnName) { int columnIndex = getColumnIndex(columnName); checkNonNullOfCodes(columnIndex, Collections.singletonList(Code.ARRAY), columnName); - checkArrayElementType(columnIndex, Arrays.asList(Code.ENUM, Code.INT64), columnName); - return getLongListInternal(columnIndex); + checkArrayElementType( + columnIndex, Arrays.asList(Code.ENUM, Code.PG_OID, Code.INT64), columnName); + return getColumnType(columnIndex).getArrayElementType().getCode() == Code.PG_OID + ? getPgOidListInternal(columnIndex) + : getLongListInternal(columnIndex); } @Override @@ -530,32 +534,6 @@ public List getPgJsonbList(String columnName) { return getPgJsonbListInternal(columnIndex); } - @Override - public long[] getPgOidArray(int columnIndex) { - checkNonNullOfType(columnIndex, Type.array(Type.pgOid()), columnIndex); - return getPgOidArrayInternal(columnIndex); - } - - @Override - public long[] getPgOidArray(String columnName) { - int columnIndex = getColumnIndex(columnName); - checkNonNullOfType(columnIndex, Type.array(Type.pgOid()), columnName); - return getPgOidArrayInternal(columnIndex); - } - - @Override - public List getPgOidList(int columnIndex) { - checkNonNullOfType(columnIndex, Type.array(Type.pgOid()), columnIndex); - return getPgOidListInternal(columnIndex); - } - - @Override - public List getPgOidList(String columnName) { - int columnIndex = getColumnIndex(columnName); - checkNonNullOfType(columnIndex, Type.array(Type.pgOid()), columnName); - return getPgOidListInternal(columnIndex); - } - @Override public List getBytesList(int columnIndex) { checkNonNullOfCodes(columnIndex, Collections.singletonList(Code.ARRAY), columnIndex); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ForwardingStructReader.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ForwardingStructReader.java index 5f19ceb6f5d..b3e37ffcddb 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ForwardingStructReader.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ForwardingStructReader.java @@ -195,18 +195,6 @@ public String getPgJsonb(String columnName) { return delegate.get().getPgJsonb(columnName); } - @Override - public long getPgOid(int columnIndex) { - checkValidState(); - return delegate.get().getPgOid(columnIndex); - } - - @Override - public long getPgOid(String columnName) { - checkValidState(); - return delegate.get().getPgOid(columnName); - } - @Override public ByteArray getBytes(int columnIndex) { checkValidState(); @@ -385,29 +373,6 @@ public List getPgJsonbList(String columnName) { return delegate.get().getPgJsonbList(columnName); } - public long[] getPgOidArray(int columnIndex) { - checkValidState(); - return delegate.get().getPgOidArray(columnIndex); - } - - @Override - public long[] getPgOidArray(String columnName) { - checkValidState(); - return delegate.get().getPgOidArray(columnName); - } - - @Override - public List getPgOidList(int columnIndex) { - checkValidState(); - return delegate.get().getPgOidList(columnIndex); - } - - @Override - public List getPgOidList(String columnName) { - checkValidState(); - return delegate.get().getPgOidList(columnName); - } - @Override public List getBytesList(int columnIndex) { checkValidState(); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStruct.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStruct.java index b939f315620..2d27642c414 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStruct.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStruct.java @@ -29,7 +29,6 @@ import com.google.cloud.spanner.AbstractResultSet.Float64Array; import com.google.cloud.spanner.AbstractResultSet.Int64Array; import com.google.cloud.spanner.AbstractResultSet.LazyByteArray; -import com.google.cloud.spanner.AbstractResultSet.PgOidArray; import com.google.cloud.spanner.Type.Code; import com.google.cloud.spanner.Type.StructField; import com.google.common.base.Preconditions; @@ -327,6 +326,7 @@ private static Struct decodeStructValue(Type structType, ListValue structValue) static Object decodeArrayValue(Type elementType, ListValue listValue) { switch (elementType.getCode()) { case INT64: + case PG_OID: case ENUM: // For int64/float64/float32/enum types, use custom containers. // These avoid wrapper object creation for non-null arrays. @@ -347,8 +347,6 @@ static Object decodeArrayValue(Type elementType, ListValue listValue) { case STRUCT: case PROTO: return Lists.transform(listValue.getValuesList(), input -> decodeValue(elementType, input)); - case PG_OID: - return new PgOidArray(listValue); default: throw new AssertionError("Unhandled type code: " + elementType.getCode()); } @@ -580,7 +578,7 @@ protected Value getValueInternal(int columnIndex) { case PG_JSONB: return Value.pgJsonb(isNull ? null : getPgJsonbInternal(columnIndex)); case PG_OID: - return Value.pgOid(isNull ? null : getPgOidInternal(columnIndex)); + return Value.pgOid(isNull ? null : getLongInternal(columnIndex)); case BYTES: return Value.internalBytes(isNull ? null : getLazyBytesInternal(columnIndex)); case PROTO: @@ -617,7 +615,7 @@ protected Value getValueInternal(int columnIndex) { case PG_JSONB: return Value.pgJsonbArray(isNull ? null : getPgJsonbListInternal(columnIndex)); case PG_OID: - return Value.pgOidArray(isNull ? null : getPgOidListInternal(columnIndex)); + return Value.pgOidArray(isNull ? null : getLongListInternal(columnIndex)); case BYTES: return Value.bytesArray(isNull ? null : getBytesListInternal(columnIndex)); case PROTO: @@ -792,9 +790,9 @@ protected List getPgJsonbListInternal(int columnIndex) { } @Override - protected PgOidArray getPgOidListInternal(int columnIndex) { + protected Int64Array getPgOidListInternal(int columnIndex) { ensureDecoded(columnIndex); - return (PgOidArray) rowData.get(columnIndex); + return (Int64Array) rowData.get(columnIndex); } @Override diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ResultSets.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ResultSets.java index 6c5c970f4d3..3d12cf5ad2c 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ResultSets.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ResultSets.java @@ -296,16 +296,6 @@ public String getPgJsonb(String columnName) { return getCurrentRowAsStruct().getPgJsonb(columnName); } - @Override - public long getPgOid(int columnIndex) { - return getCurrentRowAsStruct().getPgOid(columnIndex); - } - - @Override - public long getPgOid(String columnName) { - return getCurrentRowAsStruct().getPgOid(columnName); - } - @Override public ByteArray getBytes(int columnIndex) { return getCurrentRowAsStruct().getBytes(columnIndex); @@ -488,26 +478,6 @@ public List getPgJsonbList(String columnName) { return getCurrentRowAsStruct().getPgJsonbList(columnName); } - @Override - public long[] getPgOidArray(int columnIndex) { - return getCurrentRowAsStruct().getPgOidArray(columnIndex); - } - - @Override - public long[] getPgOidArray(String columnName) { - return getCurrentRowAsStruct().getPgOidArray(columnName); - } - - @Override - public List getPgOidList(int columnIndex) { - return getCurrentRowAsStruct().getPgOidList(columnIndex); - } - - @Override - public List getPgOidList(String columnName) { - return getCurrentRowAsStruct().getPgOidList(columnName); - } - @Override public List getBytesList(int columnIndex) { return getCurrentRowAsStruct().getBytesList(columnIndex); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Struct.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Struct.java index e2dc911a241..d54cf86090b 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Struct.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Struct.java @@ -411,6 +411,7 @@ private Object getAsObject(int columnIndex) { case BOOL: return getBooleanInternal(columnIndex); case INT64: + case PG_OID: case ENUM: return getLongInternal(columnIndex); case FLOAT32: @@ -427,8 +428,6 @@ private Object getAsObject(int columnIndex) { return getJsonInternal(columnIndex); case PG_JSONB: return getPgJsonbInternal(columnIndex); - case PG_OID: - return getPgOidInternal(columnIndex); case BYTES: case PROTO: return getBytesInternal(columnIndex); @@ -443,6 +442,7 @@ private Object getAsObject(int columnIndex) { case BOOL: return getBooleanListInternal(columnIndex); case INT64: + case PG_OID: case ENUM: return getLongListInternal(columnIndex); case FLOAT32: @@ -459,8 +459,6 @@ private Object getAsObject(int columnIndex) { return getJsonListInternal(columnIndex); case PG_JSONB: return getPgJsonbListInternal(columnIndex); - case PG_OID: - return getPgOidListInternal(columnIndex); case BYTES: case PROTO: return getBytesListInternal(columnIndex); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/StructReader.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/StructReader.java index 44f05962d7c..f9967db0451 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/StructReader.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/StructReader.java @@ -261,22 +261,6 @@ default T getProtoEnum( throw new UnsupportedOperationException("method should be overwritten"); } - /** - * @param columnIndex index of the column - * @return the value of a non-{@code NULL} column with type {@link Type#pgOid()}. - */ - default long getPgOid(int columnIndex) { - throw new UnsupportedOperationException("method should be overwritten"); - } - - /** - * @param columnName name of the column - * @return the value of a non-{@code NULL} column with type {@link Type#pgOid()}. - */ - default long getPgOid(String columnName) { - throw new UnsupportedOperationException("method should be overwritten"); - } - /** * @param columnIndex index of the column * @return the value of a non-{@code NULL} column with type {@link Type#bytes()}. @@ -593,46 +577,6 @@ default List getProtoEnumList( throw new UnsupportedOperationException("method should be overwritten"); } - /** - * @param columnIndex index of the column - * @return the value of a non-{@code NULL} column with type {@code Type.array(Type.pgOid())}. - * @throws NullPointerException if any element of the array value is {@code NULL}. If the array - * may contain {@code NULL} values, use {@link #getPgOidList(int)} instead. - */ - default long[] getPgOidArray(int columnIndex) { - throw new UnsupportedOperationException("method should be overwritten"); - }; - - /** - * @param columnName name of the column - * @return the value of a non-{@code NULL} column with type {@code Type.array(Type.pgOid())}. - * @throws NullPointerException if any element of the array value is {@code NULL}. If the array - * may contain {@code NULL} values, use {@link #getPgOidList(String)} instead. - */ - default long[] getPgOidArray(String columnName) { - throw new UnsupportedOperationException("method should be overwritten"); - }; - - /** - * @param columnIndex index of the column - * @return the value of a non-{@code NULL} column with type {@code Type.array(Type.pgOid())}. The - * list returned by this method is lazily constructed. Create a copy of it if you intend to - * access each element in the list multiple times. - */ - default List getPgOidList(int columnIndex) { - throw new UnsupportedOperationException("method should be overwritten"); - }; - - /** - * @param columnName - * @return the value of a non-{@code NULL} column with type {@code Type.array(Type.pgOid())}. The - * list returned by this method is lazily constructed. Create a copy of it if you intend to - * access each element in the list multiple times. - */ - default List getPgOidList(String columnName) { - throw new UnsupportedOperationException("method should be overwritten"); - }; - /** * @param columnIndex index of the column * @return the value of a non-{@code NULL} column with type {@code Type.array(Type.bytes())}. The diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java index 88805b02717..c2c93334143 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java @@ -2960,7 +2960,7 @@ private Value getValue(int fieldIndex) { case PG_NUMERIC: return Value.pgNumeric(value.getString(fieldIndex)); case PG_OID: - return Value.pgOid(value.getPgOid(fieldIndex)); + return Value.pgOid(value.getLong(fieldIndex)); case DATE: return Value.date(value.getDate(fieldIndex)); case TIMESTAMP: @@ -2987,7 +2987,7 @@ private Value getValue(int fieldIndex) { case PG_JSONB: return Value.pgJsonbArray(value.getPgJsonbList(fieldIndex)); case PG_OID: - return Value.pgOidArray(value.getPgOidList(fieldIndex)); + return Value.pgOidArray(value.getLongList(fieldIndex)); case BYTES: case PROTO: return Value.bytesArray(value.getBytesList(fieldIndex)); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DirectExecuteResultSet.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DirectExecuteResultSet.java index 9a622c342fd..b5e4060ddd8 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DirectExecuteResultSet.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DirectExecuteResultSet.java @@ -252,18 +252,6 @@ public String getPgJsonb(String columnName) { return delegate.getPgJsonb(columnName); } - @Override - public long getPgOid(int columnIndex) { - Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); - return delegate.getPgOid(columnIndex); - } - - @Override - public long getPgOid(String columnName) { - Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); - return delegate.getPgOid(columnName); - } - @Override public ByteArray getBytes(int columnIndex) { Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); @@ -456,30 +444,6 @@ public List getPgJsonbList(String columnName) { return delegate.getPgJsonbList(columnName); } - @Override - public long[] getPgOidArray(int columnIndex) { - Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); - return delegate.getPgOidArray(columnIndex); - } - - @Override - public long[] getPgOidArray(String columnName) { - Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); - return delegate.getPgOidArray(columnName); - } - - @Override - public List getPgOidList(int columnIndex) { - Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); - return delegate.getPgOidList(columnIndex); - } - - @Override - public List getPgOidList(String columnName) { - Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); - return delegate.getPgOidList(columnName); - } - @Override public List getBytesList(int columnIndex) { Preconditions.checkState(nextCalledByClient, MISSING_NEXT_CALL); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReplaceableForwardingResultSet.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReplaceableForwardingResultSet.java index 7e62b23c4c2..bd7c794a0fa 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReplaceableForwardingResultSet.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReplaceableForwardingResultSet.java @@ -261,18 +261,6 @@ public String getPgJsonb(String columnName) { return delegate.getPgJsonb(columnName); } - @Override - public long getPgOid(int columnIndex) { - checkClosed(); - return delegate.getPgOid(columnIndex); - } - - @Override - public long getPgOid(String columnName) { - checkClosed(); - return delegate.getPgOid(columnName); - } - @Override public ByteArray getBytes(int columnIndex) { checkClosed(); @@ -465,30 +453,6 @@ public List getPgJsonbList(String columnName) { return delegate.getPgJsonbList(columnName); } - @Override - public long[] getPgOidArray(int columnIndex) { - checkClosed(); - return delegate.getPgOidArray(columnIndex); - } - - @Override - public long[] getPgOidArray(String columnName) { - checkClosed(); - return delegate.getPgOidArray(columnName); - } - - @Override - public List getPgOidList(int columnIndex) { - checkClosed(); - return delegate.getPgOidList(columnIndex); - } - - @Override - public List getPgOidList(String columnName) { - checkClosed(); - return delegate.getPgOidList(columnName); - } - @Override public List getBytesList(int columnIndex) { checkClosed(); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java index 980f5ae74f9..06c91fffe17 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java @@ -302,11 +302,7 @@ public static Collection parameters() { Collections.singletonList("getValue") }, { - Type.pgOid(), - "getPgOidInternal", - 123L, - "getPgOid", - Collections.singletonList("getValue") + Type.pgOid(), "getPgOidInternal", 123L, "getLong", Collections.singletonList("getValue") }, { Type.timestamp(), @@ -410,8 +406,15 @@ public static Collection parameters() { Type.array(Type.pgOid()), "getPgOidArrayInternal", new long[] {1, 2}, - "getPgOidArray", - Arrays.asList("getPgOidList", "getValue") + "getLongArray", + Arrays.asList("getLongList", "getValue") + }, + { + Type.array(Type.pgOid()), + "getPgOidListInternal", + Arrays.asList(3L, 4L), + "getLongList", + Arrays.asList("getLongArray", "getValue") }, { Type.array(Type.bytes()), diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java index 13025ff6745..2051e006d81 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java @@ -798,9 +798,9 @@ public void getPgOid() { consumer.onCompleted(); assertThat(resultSet.next()).isTrue(); - assertThat(resultSet.getPgOid(0)).isEqualTo(Long.MIN_VALUE); + assertThat(resultSet.getLong(0)).isEqualTo(Long.MIN_VALUE); assertThat(resultSet.next()).isTrue(); - assertThat(resultSet.getPgOid(0)).isEqualTo(Long.MAX_VALUE); + assertThat(resultSet.getLong(0)).isEqualTo(Long.MAX_VALUE); } @Test @@ -1038,7 +1038,7 @@ public void getPgOidArray() { .build()); consumer.onCompleted(); assertThat(resultSet.next()).isTrue(); - assertThat(resultSet.getPgOidArray(0)).isEqualTo(longArray); + assertThat(resultSet.getLongArray(0)).isEqualTo(longArray); } @Test diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsTest.java index 0eccc2d94a5..3ca550caa2d 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsTest.java @@ -319,7 +319,7 @@ public void resultSetIteration() { assertEquals(jsonVal, rs.getPgJsonb("pgJsonbVal")); assertEquals(Value.pgJsonb(jsonVal), rs.getValue("pgJsonbVal")); - assertThat(rs.getPgOid(columnIndex)).isEqualTo(2L); + assertThat(rs.getLong(columnIndex)).isEqualTo(2L); assertThat(rs.getValue(columnIndex++)).isEqualTo(Value.pgOid(2L)); assertThat(rs.getColumnType("pgOidVal")).isEqualTo(Type.pgOid()); @@ -410,12 +410,12 @@ public void resultSetIteration() { assertEquals(Arrays.asList(jsonArray), rs.getPgJsonbList(columnIndex++)); assertEquals(Arrays.asList(jsonArray), rs.getPgJsonbList("pgJsonbArray")); - assertThat(rs.getPgOidArray(columnIndex)).isEqualTo(longArray); + assertThat(rs.getLongArray(columnIndex)).isEqualTo(longArray); assertThat(rs.getValue(columnIndex)).isEqualTo(Value.pgOidArray(longArray)); - assertThat(rs.getPgOidArray("pgOidArray")).isEqualTo(longArray); + assertThat(rs.getLongArray("pgOidArray")).isEqualTo(longArray); assertThat(rs.getValue("pgOidArray")).isEqualTo(Value.pgOidArray(longArray)); - assertThat(rs.getPgOidList(columnIndex++)).isEqualTo(Longs.asList(longArray)); - assertThat(rs.getPgOidList("pgOidArray")).isEqualTo(Longs.asList(longArray)); + assertThat(rs.getLongList(columnIndex++)).isEqualTo(Longs.asList(longArray)); + assertThat(rs.getLongList("pgOidArray")).isEqualTo(Longs.asList(longArray)); assertThat(rs.getProtoMessageList(columnIndex, SingerInfo.getDefaultInstance())) .isEqualTo(Arrays.asList(protoMessageArray)); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java index 80eaceff439..e457a6fe219 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java @@ -575,7 +575,7 @@ public void testSelectAllTypes() { assertEquals(DATE_VALUE, resultSet.getDate(++col)); assertEquals(TIMESTAMP_VALUE, resultSet.getTimestamp(++col)); if (dialect == Dialect.POSTGRESQL) { - assertEquals(PG_OID_VALUE, resultSet.getPgOid(++col)); + assertEquals(PG_OID_VALUE, resultSet.getLong(++col)); } assertEquals(BOOL_ARRAY_VALUE, resultSet.getBooleanList(++col)); @@ -597,7 +597,7 @@ public void testSelectAllTypes() { assertEquals(DATE_ARRAY_VALUE, resultSet.getDateList(++col)); assertEquals(TIMESTAMP_ARRAY_VALUE, resultSet.getTimestampList(++col)); if (dialect == Dialect.POSTGRESQL) { - assertEquals(PG_OID_ARRAY_VALUE, resultSet.getPgOidList(++col)); + assertEquals(PG_OID_ARRAY_VALUE, resultSet.getLongList(++col)); } assertFalse(resultSet.next()); } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DirectExecuteResultSetTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DirectExecuteResultSetTest.java index 6837b10ad65..b14f837ff7b 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DirectExecuteResultSetTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DirectExecuteResultSetTest.java @@ -293,19 +293,6 @@ public void testValidMethodCall() throws IllegalArgumentException { subject.getPgJsonbList("test2"); verify(delegate).getPgJsonbList("test2"); - subject.getPgOid(0); - verify(delegate).getPgOid(0); - subject.getPgOid("test0"); - verify(delegate).getPgOid("test0"); - subject.getPgOidArray(1); - verify(delegate).getPgOidArray(1); - subject.getPgOidArray("test1"); - verify(delegate).getPgOidArray("test1"); - subject.getPgOidList(2); - verify(delegate).getPgOidList(2); - subject.getPgOidList("test2"); - verify(delegate).getPgOidList("test2"); - subject.getProtoMessage(0, SingerInfo.getDefaultInstance()); verify(delegate).getProtoMessage(0, SingerInfo.getDefaultInstance()); subject.getProtoMessage("test0", SingerInfo.getDefaultInstance()); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java index 9260dcb7c7a..18044c452b5 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java @@ -293,7 +293,7 @@ public void bindPgOid() { Statement.newBuilder(selectValueQuery).bind("p1").to(Value.pgOid(1234)), Type.pgOid()); assertThat(row.isNull(0)).isFalse(); - assertThat(row.getPgOid(0)).isEqualTo(1234); + assertThat(row.getLong(0)).isEqualTo(1234); } } From 039079e858feee866ce5f0557e0cf23dcce3cd37 Mon Sep 17 00:00:00 2001 From: Arpan Mishra Date: Mon, 25 Mar 2024 20:16:31 +0530 Subject: [PATCH 25/47] chore: generalise session pool class for multiplexed session. (#2964) * chore: generalise session pool class for multiplexed session. * chore: add back previous code. * chore: address comments. --- .../cloud/spanner/DatabaseClientImpl.java | 4 +- .../com/google/cloud/spanner/SessionPool.java | 225 ++++++++++++------ .../SessionPoolAsyncTransactionManager.java | 19 +- 3 files changed, 172 insertions(+), 76 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClientImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClientImpl.java index b63ad379305..e9c9818f451 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClientImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClientImpl.java @@ -257,7 +257,9 @@ private T runWithSessionRetry(Function callable) { try { return callable.apply(session); } catch (SessionNotFoundException e) { - session = pool.replaceSession(e, session); + session = + (PooledSessionFuture) + pool.getPooledSessionReplacementHandler().replaceSession(e, session); } } } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java index 8058802a8fc..92ecbc3d55e 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java @@ -166,7 +166,8 @@ public ResultSet get() { * Wrapper around {@code ReadContext} that releases the session to the pool once the call is * finished, if it is a single use context. */ - private static class AutoClosingReadContext implements ReadContext { + private static class AutoClosingReadContext + implements ReadContext { /** * {@link AsyncResultSet} implementation that keeps track of the async operations that are still * running for this {@link ReadContext} and that should finish before the {@link ReadContext} @@ -201,9 +202,10 @@ public ApiFuture setCallback(Executor exec, ReadyCallback cb) { } } - private final Function readContextDelegateSupplier; + private final Function readContextDelegateSupplier; private T readContextDelegate; private final SessionPool sessionPool; + private final SessionReplacementHandler sessionReplacementHandler; private final boolean isSingleUse; private final AtomicInteger asyncOperationsCount = new AtomicInteger(); @@ -213,7 +215,7 @@ public ApiFuture setCallback(Executor exec, ReadyCallback cb) { private boolean sessionUsedForQuery = false; @GuardedBy("lock") - private PooledSessionFuture session; + private I session; @GuardedBy("lock") private boolean closed; @@ -222,12 +224,14 @@ public ApiFuture setCallback(Executor exec, ReadyCallback cb) { private boolean delegateClosed; private AutoClosingReadContext( - Function delegateSupplier, + Function delegateSupplier, SessionPool sessionPool, - PooledSessionFuture session, + SessionReplacementHandler sessionReplacementHandler, + I session, boolean isSingleUse) { this.readContextDelegateSupplier = delegateSupplier; this.sessionPool = sessionPool; + this.sessionReplacementHandler = sessionReplacementHandler; this.session = session; this.isSingleUse = isSingleUse; } @@ -293,7 +297,7 @@ private boolean internalNext() { } catch (SpannerException e) { synchronized (lock) { if (!closed && isSingleUse) { - session.get().lastException = e; + session.get().setLastException(e); AutoClosingReadContext.this.close(); } } @@ -319,7 +323,7 @@ private void replaceSessionIfPossible(SessionNotFoundException notFound) { if (isSingleUse || !sessionUsedForQuery) { // This class is only used by read-only transactions, so we know that we only need a // read-only session. - session = sessionPool.replaceSession(notFound, session); + session = sessionReplacementHandler.replaceSession(notFound, session); readContextDelegate = readContextDelegateSupplier.apply(session); } else { throw notFound; @@ -529,15 +533,16 @@ public void close() { } } - private static class AutoClosingReadTransaction - extends AutoClosingReadContext implements ReadOnlyTransaction { + private static class AutoClosingReadTransaction + extends AutoClosingReadContext implements ReadOnlyTransaction { AutoClosingReadTransaction( - Function txnSupplier, + Function txnSupplier, SessionPool sessionPool, - PooledSessionFuture session, + SessionReplacementHandler sessionReplacementHandler, + I session, boolean isSingleUse) { - super(txnSupplier, sessionPool, session, isSingleUse); + super(txnSupplier, sessionPool, sessionReplacementHandler, session, isSingleUse); } @Override @@ -546,6 +551,29 @@ public Timestamp getReadTimestamp() { } } + interface SessionReplacementHandler { + T replaceSession(SessionNotFoundException notFound, T sessionFuture); + } + + class PooledSessionReplacementHandler implements SessionReplacementHandler { + @Override + public PooledSessionFuture replaceSession( + SessionNotFoundException e, PooledSessionFuture session) { + if (!options.isFailIfSessionNotFound() && session.get().isAllowReplacing()) { + synchronized (lock) { + numSessionsInUse--; + numSessionsReleased++; + checkedOutSessions.remove(session); + } + session.leakedException = null; + invalidateSession(session.get()); + return getSession(); + } else { + throw e; + } + } + } + interface SessionNotFoundHandler { /** * Handles the given {@link SessionNotFoundException} by possibly converting it to a different @@ -798,20 +826,22 @@ public void close() { } } - private static class AutoClosingTransactionManager + private static class AutoClosingTransactionManager implements TransactionManager, SessionNotFoundHandler { private TransactionManager delegate; - private final SessionPool sessionPool; - private PooledSessionFuture session; + private T session; + private final SessionReplacementHandler sessionReplacementHandler; private final TransactionOption[] options; private boolean closed; private boolean restartedAfterSessionNotFound; AutoClosingTransactionManager( - SessionPool sessionPool, PooledSessionFuture session, TransactionOption... options) { - this.sessionPool = sessionPool; + T session, + SessionReplacementHandler sessionReplacementHandler, + TransactionOption... options) { this.session = session; this.options = options; + this.sessionReplacementHandler = sessionReplacementHandler; } @Override @@ -830,9 +860,9 @@ private TransactionContext internalBegin() { @Override public SpannerException handleSessionNotFound(SessionNotFoundException notFoundException) { - session = sessionPool.replaceSession(notFoundException, session); - PooledSession pooledSession = session.get(); - delegate = pooledSession.delegate.transactionManager(options); + session = sessionReplacementHandler.replaceSession(notFoundException, session); + CachedSession cachedSession = session.get(); + delegate = cachedSession.getDelegate().transactionManager(options); restartedAfterSessionNotFound = true; return createAbortedExceptionWithMinimalRetryDelay(notFoundException); } @@ -880,9 +910,9 @@ public TransactionContext resetForRetry() { return new SessionPoolTransactionContext(this, delegate.resetForRetry()); } } catch (SessionNotFoundException e) { - session = sessionPool.replaceSession(e, session); - PooledSession pooledSession = session.get(); - delegate = pooledSession.delegate.transactionManager(options); + session = sessionReplacementHandler.replaceSession(e, session); + CachedSession cachedSession = session.get(); + delegate = cachedSession.getDelegate().transactionManager(options); restartedAfterSessionNotFound = true; } } @@ -927,17 +957,21 @@ public TransactionState getState() { * {@link TransactionRunner} that automatically handles {@link SessionNotFoundException}s by * replacing the underlying session and then restarts the transaction. */ - private static final class SessionPoolTransactionRunner implements TransactionRunner { - private final SessionPool sessionPool; - private PooledSessionFuture session; + private static final class SessionPoolTransactionRunner + implements TransactionRunner { + + private I session; + private final SessionReplacementHandler sessionReplacementHandler; private final TransactionOption[] options; private TransactionRunner runner; private SessionPoolTransactionRunner( - SessionPool sessionPool, PooledSessionFuture session, TransactionOption... options) { - this.sessionPool = sessionPool; + I session, + SessionReplacementHandler sessionReplacementHandler, + TransactionOption... options) { this.session = session; this.options = options; + this.sessionReplacementHandler = sessionReplacementHandler; } private TransactionRunner getRunner() { @@ -957,15 +991,16 @@ public T run(TransactionCallable callable) { result = getRunner().run(callable); break; } catch (SessionNotFoundException e) { - session = sessionPool.replaceSession(e, session); - PooledSession ps = session.get(); - runner = ps.delegate.readWriteTransaction(); + session = sessionReplacementHandler.replaceSession(e, session); + CachedSession cachedSession = session.get(); + runner = cachedSession.getDelegate().readWriteTransaction(); } } session.get().markUsed(); return result; } catch (SpannerException e) { - throw session.get().lastException = e; + session.get().setLastException(e); + throw e; } finally { session.close(); } @@ -988,17 +1023,19 @@ public TransactionRunner allowNestedTransaction() { } } - private static class SessionPoolAsyncRunner implements AsyncRunner { - private final SessionPool sessionPool; - private volatile PooledSessionFuture session; + private static class SessionPoolAsyncRunner implements AsyncRunner { + private volatile I session; + private final SessionReplacementHandler sessionReplacementHandler; private final TransactionOption[] options; private SettableApiFuture commitResponse; private SessionPoolAsyncRunner( - SessionPool sessionPool, PooledSessionFuture session, TransactionOption... options) { - this.sessionPool = sessionPool; + I session, + SessionReplacementHandler sessionReplacementHandler, + TransactionOption... options) { this.session = session; this.options = options; + this.sessionReplacementHandler = sessionReplacementHandler; } @Override @@ -1027,7 +1064,9 @@ public ApiFuture runAsync(final AsyncWork work, Executor executor) { try { // The replaceSession method will re-throw the SessionNotFoundException if the // session cannot be replaced with a new one. - session = sessionPool.replaceSession((SessionNotFoundException) se, session); + session = + sessionReplacementHandler.replaceSession( + (SessionNotFoundException) se, session); se = null; } catch (SessionNotFoundException e) { exception = e; @@ -1098,8 +1137,24 @@ private PooledSessionFuture createPooledSessionFuture( return new PooledSessionFuture(future, span); } + interface SessionFuture extends Session { + + /** + * We need to do this because every implementation of {@link SessionFuture} today extends {@link + * SimpleForwardingListenableFuture}. The get() method in parent {@link + * java.util.concurrent.Future} classes specifies checked exceptions in method signature. + * + *

    This method is a workaround we don't have to handle checked exceptions specified by other + * interfaces. + */ + CachedSession get(); + + default void addListener(Runnable listener, Executor exec) {} + } + class PooledSessionFuture extends SimpleForwardingListenableFuture - implements Session { + implements SessionFuture { + private volatile LeakedSessionException leakedException; private volatile AtomicBoolean inUse = new AtomicBoolean(); private volatile CountDownLatch initialized = new CountDownLatch(1); @@ -1172,6 +1227,7 @@ public ReadContext singleUse() { return ps.delegate.singleUse(); }, SessionPool.this, + pooledSessionReplacementHandler, this, true); } catch (Exception e) { @@ -1189,6 +1245,7 @@ public ReadContext singleUse(final TimestampBound bound) { return ps.delegate.singleUse(bound); }, SessionPool.this, + pooledSessionReplacementHandler, this, true); } catch (Exception e) { @@ -1241,8 +1298,12 @@ private ReadOnlyTransaction internalReadOnlyTransaction( Function transactionSupplier, boolean isSingleUse) { try { - return new AutoClosingReadTransaction( - transactionSupplier, SessionPool.this, this, isSingleUse); + return new AutoClosingReadTransaction<>( + transactionSupplier, + SessionPool.this, + pooledSessionReplacementHandler, + this, + isSingleUse); } catch (Exception e) { close(); throw e; @@ -1251,22 +1312,23 @@ private ReadOnlyTransaction internalReadOnlyTransaction( @Override public TransactionRunner readWriteTransaction(TransactionOption... options) { - return new SessionPoolTransactionRunner(SessionPool.this, this, options); + return new SessionPoolTransactionRunner<>(this, pooledSessionReplacementHandler, options); } @Override public TransactionManager transactionManager(TransactionOption... options) { - return new AutoClosingTransactionManager(SessionPool.this, this, options); + return new AutoClosingTransactionManager<>(this, pooledSessionReplacementHandler, options); } @Override public AsyncRunner runAsync(TransactionOption... options) { - return new SessionPoolAsyncRunner(SessionPool.this, this, options); + return new SessionPoolAsyncRunner(this, pooledSessionReplacementHandler, options); } @Override public AsyncTransactionManager transactionManagerAsync(TransactionOption... options) { - return new SessionPoolAsyncTransactionManager(SessionPool.this, this, options); + return new SessionPoolAsyncTransactionManager<>( + pooledSessionReplacementHandler, this, options); } @Override @@ -1358,7 +1420,25 @@ PooledSession get(final boolean eligibleForLongRunning) { } } - class PooledSession implements Session { + interface CachedSession extends Session { + + SessionImpl getDelegate(); + + void markBusy(ISpan span); + + void markUsed(); + + SpannerException setLastException(SpannerException exception); + + boolean isAllowReplacing(); + + AsyncTransactionManagerImpl transactionManagerAsync(TransactionOption... options); + + void setAllowReplacing(boolean b); + } + + class PooledSession implements CachedSession { + @VisibleForTesting SessionImpl delegate; private volatile SpannerException lastException; private volatile boolean allowReplacing = true; @@ -1416,7 +1496,8 @@ public String toString() { } @VisibleForTesting - void setAllowReplacing(boolean allowReplacing) { + @Override + public void setAllowReplacing(boolean allowReplacing) { this.allowReplacing = allowReplacing; } @@ -1612,7 +1693,13 @@ private Dialect determineDialect() { } } - private void markBusy(ISpan span) { + @Override + public SessionImpl getDelegate() { + return this.delegate; + } + + @Override + public void markBusy(ISpan span) { this.delegate.setCurrentSpan(span); this.state = SessionState.BUSY; } @@ -1621,10 +1708,22 @@ private void markClosing() { this.state = SessionState.CLOSING; } - void markUsed() { + @Override + public void markUsed() { delegate.markUsed(clock.instant()); } + @Override + public SpannerException setLastException(SpannerException exception) { + this.lastException = exception; + return exception; + } + + @Override + public boolean isAllowReplacing() { + return this.allowReplacing; + } + @Override public TransactionManager transactionManager(TransactionOption... options) { return delegate.transactionManager(options); @@ -1728,6 +1827,7 @@ private PooledSession pollUninterruptiblyWithTimeout( *

*/ final class PoolMaintainer { + // Length of the window in millis over which we keep track of maximum number of concurrent // sessions in use. private final Duration windowLength = Duration.ofMillis(TimeUnit.MINUTES.toMillis(10)); @@ -1932,9 +2032,9 @@ private void removeLongRunningSessions( // the below get() call on future object is non-blocking since checkedOutSessions // collection is populated only when the get() method in {@code PooledSessionFuture} is // called. - final PooledSession session = sessionFuture.get(); + final PooledSession session = (PooledSession) sessionFuture.get(); final Duration durationFromLastUse = - Duration.between(session.delegate.getLastUseTime(), currentTime); + Duration.between(session.getDelegate().getLastUseTime(), currentTime); if (!session.eligibleForLongRunning && durationFromLastUse.compareTo( inactiveTransactionRemovalOptions.getIdleTimeThreshold()) @@ -2090,6 +2190,8 @@ enum Position { @VisibleForTesting Function longRunningSessionRemovedListener; private final CountDownLatch waitOnMinSessionsLatch; + private final SessionReplacementHandler pooledSessionReplacementHandler = + new PooledSessionReplacementHandler(); /** * Create a session pool with the given options and for the given database. It will also start @@ -2237,7 +2339,7 @@ Dialect getDialect() { } if (mustDetectDialect) { try (PooledSessionFuture session = getSession()) { - dialect.set(session.get().determineDialect()); + dialect.set(((PooledSession) session.get()).determineDialect()); } } try { @@ -2251,6 +2353,10 @@ Dialect getDialect() { } } + SessionReplacementHandler getPooledSessionReplacementHandler() { + return pooledSessionReplacementHandler; + } + @Nullable public String getDatabaseRole() { return databaseRole; @@ -2451,21 +2557,6 @@ private PooledSessionFuture checkoutSession( return res; } - PooledSessionFuture replaceSession(SessionNotFoundException e, PooledSessionFuture session) { - if (!options.isFailIfSessionNotFound() && session.get().allowReplacing) { - synchronized (lock) { - numSessionsInUse--; - numSessionsReleased++; - checkedOutSessions.remove(session); - } - session.leakedException = null; - invalidateSession(session.get()); - return getSession(); - } else { - throw e; - } - } - private void incrementNumSessionsInUse() { synchronized (lock) { if (maxSessionsInUse < ++numSessionsInUse) { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolAsyncTransactionManager.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolAsyncTransactionManager.java index b6442fd2182..90f5317e88d 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolAsyncTransactionManager.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolAsyncTransactionManager.java @@ -22,15 +22,16 @@ import com.google.api.core.SettableApiFuture; import com.google.cloud.Timestamp; import com.google.cloud.spanner.Options.TransactionOption; -import com.google.cloud.spanner.SessionPool.PooledSessionFuture; +import com.google.cloud.spanner.SessionPool.SessionFuture; import com.google.cloud.spanner.SessionPool.SessionNotFoundHandler; +import com.google.cloud.spanner.SessionPool.SessionReplacementHandler; import com.google.cloud.spanner.TransactionContextFutureImpl.CommittableAsyncTransactionManager; import com.google.cloud.spanner.TransactionManager.TransactionState; import com.google.common.base.Preconditions; import com.google.common.util.concurrent.MoreExecutors; import javax.annotation.concurrent.GuardedBy; -class SessionPoolAsyncTransactionManager +class SessionPoolAsyncTransactionManager implements CommittableAsyncTransactionManager, SessionNotFoundHandler { private final Object lock = new Object(); @@ -40,20 +41,22 @@ class SessionPoolAsyncTransactionManager @GuardedBy("lock") private AbortedException abortedException; - private final SessionPool pool; + private final SessionReplacementHandler sessionReplacementHandler; private final TransactionOption[] options; - private volatile PooledSessionFuture session; + private volatile I session; private volatile SettableApiFuture delegate; private boolean restartedAfterSessionNotFound; SessionPoolAsyncTransactionManager( - SessionPool pool, PooledSessionFuture session, TransactionOption... options) { - this.pool = Preconditions.checkNotNull(pool); + SessionReplacementHandler sessionReplacementHandler, + I session, + TransactionOption... options) { this.options = options; + this.sessionReplacementHandler = sessionReplacementHandler; createTransaction(session); } - private void createTransaction(PooledSessionFuture session) { + private void createTransaction(I session) { this.session = session; this.delegate = SettableApiFuture.create(); this.session.addListener( @@ -75,7 +78,7 @@ private void createTransaction(PooledSessionFuture session) { public SpannerException handleSessionNotFound(SessionNotFoundException notFound) { // Restart the entire transaction with a new session and throw an AbortedException to force the // client application to retry. - createTransaction(pool.replaceSession(notFound, session)); + createTransaction(sessionReplacementHandler.replaceSession(notFound, session)); restartedAfterSessionNotFound = true; return SpannerExceptionFactory.newSpannerException( ErrorCode.ABORTED, notFound.getMessage(), notFound); From 5df12caf490113ddc6ffb8d075ccac5766091798 Mon Sep 17 00:00:00 2001 From: Quynh Tran Date: Thu, 28 Mar 2024 17:31:52 +1100 Subject: [PATCH 26/47] chore: emove unnecessary debug. --- .../google/cloud/spanner/connection/AllTypesMockServerTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java index e457a6fe219..3313fa53426 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AllTypesMockServerTest.java @@ -613,7 +613,6 @@ public void testInsertAllTypes() { ExecuteSqlRequest request = mockSpanner.getRequestsOfType(ExecuteSqlRequest.class).get(0); Map paramTypes = request.getParamTypesMap(); Map params = request.getParams().getFieldsMap(); - System.out.println("Dialect = " + dialect); assertEquals(dialect == Dialect.POSTGRESQL ? 22 : 20, paramTypes.size()); assertEquals(dialect == Dialect.POSTGRESQL ? 22 : 20, params.size()); From 4b12761b0254fc3cfac100d43f67cbf0ca70f0ae Mon Sep 17 00:00:00 2001 From: Arpan Mishra Date: Thu, 28 Mar 2024 14:45:36 +0530 Subject: [PATCH 27/47] chore: add multiplexed session implementations for CachedSession/SessionFuture interfaces. (#2973) * chore: add multiplexed session implementations for CachedSession/SessionFuture interfaces. * chore: add comments. * chore: add session replacement handler for multiplexed session. * chore: address comments. * chore: fix comments. * chore: fix comments. --- .../com/google/cloud/spanner/SessionPool.java | 433 +++++++++++++++++- 1 file changed, 432 insertions(+), 1 deletion(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java index 92ecbc3d55e..a5eee9d0db7 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java @@ -574,6 +574,23 @@ public PooledSessionFuture replaceSession( } } + static class MultiplexedSessionReplacementHandler + implements SessionReplacementHandler { + @Override + public MultiplexedSessionFuture replaceSession( + SessionNotFoundException e, MultiplexedSessionFuture session) { + /** + * For multiplexed sessions, we would never obtain a {@link SessionNotFoundException}. Hence, + * this method will ideally never be invoked. + */ + logger.log( + Level.WARNING, + String.format( + "Replace session invoked for multiplexed session => %s", session.getName())); + throw e; + } + } + interface SessionNotFoundHandler { /** * Handles the given {@link SessionNotFoundException} by possibly converting it to a different @@ -1420,16 +1437,254 @@ PooledSession get(final boolean eligibleForLongRunning) { } } + class MultiplexedSessionFuture extends SimpleForwardingListenableFuture + implements SessionFuture { + private final ISpan span; + + @VisibleForTesting + MultiplexedSessionFuture(ListenableFuture delegate, ISpan span) { + super(delegate); + this.span = span; + } + + @Override + public Timestamp write(Iterable mutations) throws SpannerException { + return writeWithOptions(mutations).getCommitTimestamp(); + } + + @Override + public CommitResponse writeWithOptions( + Iterable mutations, TransactionOption... options) throws SpannerException { + try { + return get().writeWithOptions(mutations, options); + } finally { + close(); + } + } + + @Override + public Timestamp writeAtLeastOnce(Iterable mutations) throws SpannerException { + return writeAtLeastOnceWithOptions(mutations).getCommitTimestamp(); + } + + @Override + public CommitResponse writeAtLeastOnceWithOptions( + Iterable mutations, TransactionOption... options) throws SpannerException { + try { + return get().writeAtLeastOnceWithOptions(mutations, options); + } finally { + close(); + } + } + + @Override + public ServerStream batchWriteAtLeastOnce( + Iterable mutationGroups, TransactionOption... options) + throws SpannerException { + try { + return get().batchWriteAtLeastOnce(mutationGroups, options); + } finally { + close(); + } + } + + @Override + public ReadContext singleUse() { + try { + return new AutoClosingReadContext<>( + session -> { + MultiplexedSession multiplexedSession = session.get(); + return multiplexedSession.getDelegate().singleUse(); + }, + SessionPool.this, + multiplexedSessionReplacementHandler, + this, + true); + } catch (Exception e) { + close(); + throw e; + } + } + + @Override + public ReadContext singleUse(final TimestampBound bound) { + try { + return new AutoClosingReadContext<>( + session -> { + MultiplexedSession multiplexedSession = session.get(); + return multiplexedSession.getDelegate().singleUse(bound); + }, + SessionPool.this, + multiplexedSessionReplacementHandler, + this, + true); + } catch (Exception e) { + close(); + throw e; + } + } + + @Override + public ReadOnlyTransaction singleUseReadOnlyTransaction() { + return internalReadOnlyTransaction( + session -> { + MultiplexedSession multiplexedSession = session.get(); + return multiplexedSession.getDelegate().singleUseReadOnlyTransaction(); + }, + true); + } + + @Override + public ReadOnlyTransaction singleUseReadOnlyTransaction(final TimestampBound bound) { + return internalReadOnlyTransaction( + session -> { + MultiplexedSession multiplexedSession = session.get(); + return multiplexedSession.getDelegate().singleUseReadOnlyTransaction(bound); + }, + true); + } + + @Override + public ReadOnlyTransaction readOnlyTransaction() { + return internalReadOnlyTransaction( + session -> { + MultiplexedSession multiplexedSession = session.get(); + return multiplexedSession.getDelegate().readOnlyTransaction(); + }, + false); + } + + @Override + public ReadOnlyTransaction readOnlyTransaction(final TimestampBound bound) { + return internalReadOnlyTransaction( + session -> { + MultiplexedSession multiplexedSession = session.get(); + return multiplexedSession.getDelegate().readOnlyTransaction(bound); + }, + false); + } + + private ReadOnlyTransaction internalReadOnlyTransaction( + Function transactionSupplier, + boolean isSingleUse) { + try { + return new AutoClosingReadTransaction<>( + transactionSupplier, + SessionPool.this, + multiplexedSessionReplacementHandler, + this, + isSingleUse); + } catch (Exception e) { + close(); + throw e; + } + } + + @Override + public TransactionRunner readWriteTransaction(TransactionOption... options) { + return new SessionPoolTransactionRunner<>( + this, multiplexedSessionReplacementHandler, options); + } + + @Override + public TransactionManager transactionManager(TransactionOption... options) { + return new AutoClosingTransactionManager<>( + this, multiplexedSessionReplacementHandler, options); + } + + @Override + public AsyncRunner runAsync(TransactionOption... options) { + return new SessionPoolAsyncRunner(this, multiplexedSessionReplacementHandler, options); + } + + @Override + public AsyncTransactionManager transactionManagerAsync(TransactionOption... options) { + return new SessionPoolAsyncTransactionManager<>( + multiplexedSessionReplacementHandler, this, options); + } + + @Override + public long executePartitionedUpdate(Statement stmt, UpdateOption... options) { + try { + return get().executePartitionedUpdate(stmt, options); + } finally { + close(); + } + } + + @Override + public String getName() { + return get().getName(); + } + + @Override + public void prepareReadWriteTransaction() { + get().prepareReadWriteTransaction(); + } + + @Override + public void close() { + try { + asyncClose().get(); + } catch (InterruptedException e) { + throw SpannerExceptionFactory.propagateInterrupt(e); + } catch (ExecutionException e) { + throw SpannerExceptionFactory.asSpannerException(e.getCause()); + } + } + + @Override + public ApiFuture asyncClose() { + MultiplexedSession delegate = getOrNull(); + if (delegate != null) { + return delegate.asyncClose(); + } + return ApiFutures.immediateFuture(Empty.getDefaultInstance()); + } + + private MultiplexedSession getOrNull() { + try { + return get(); + } catch (Throwable ignore) { + // this exception will never be thrown for a multiplexed session since the Future + // object is already initialised. + return null; + } + } + + @Override + public MultiplexedSession get() { + MultiplexedSession res = null; + try { + res = super.get(); + } catch (Throwable e) { + // ignore the exception as it will be handled by the call to super.get() below. + } + if (res != null) { + res.markBusy(span); + } + try { + return super.get(); + } catch (ExecutionException e) { + throw SpannerExceptionFactory.newSpannerException(e.getCause()); + } catch (InterruptedException e) { + throw SpannerExceptionFactory.propagateInterrupt(e); + } + } + } + interface CachedSession extends Session { SessionImpl getDelegate(); + // TODO This method can be removed once we fully migrate to multiplexed sessions. void markBusy(ISpan span); void markUsed(); SpannerException setLastException(SpannerException exception); + // TODO This method can be removed once we fully migrate to multiplexed sessions. boolean isAllowReplacing(); AsyncTransactionManagerImpl transactionManagerAsync(TransactionOption... options); @@ -1730,6 +1985,175 @@ public TransactionManager transactionManager(TransactionOption... options) { } } + class MultiplexedSession implements CachedSession { + final SessionImpl delegate; + private volatile SpannerException lastException; + + MultiplexedSession(SessionImpl session) { + this.delegate = session; + } + + @Override + public boolean isAllowReplacing() { + // for multiplexed session there is only 1 session, hence there is nothing that we + // can replace. + return false; + } + + @Override + public void setAllowReplacing(boolean allowReplacing) { + // for multiplexed session there is only 1 session, there is nothing that can be replaced. + // hence this is no-op. + } + + @Override + public void markBusy(ISpan span) { + // no-op for a multiplexed session since a new span is already created and set in context + // for every handler invocation. + } + + @Override + public void markUsed() { + // no-op for a multiplexed session since we don't track the last-used time + // in case of multiplexed session + } + + @Override + public SpannerException setLastException(SpannerException exception) { + this.lastException = exception; + return exception; + } + + @Override + public SessionImpl getDelegate() { + return delegate; + } + + @Override + public Timestamp write(Iterable mutations) throws SpannerException { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.UNIMPLEMENTED, "Unimplemented with Multiplexed Session"); + } + + @Override + public CommitResponse writeWithOptions( + Iterable mutations, TransactionOption... options) throws SpannerException { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.UNIMPLEMENTED, "Unimplemented with Multiplexed Session"); + } + + @Override + public Timestamp writeAtLeastOnce(Iterable mutations) throws SpannerException { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.UNIMPLEMENTED, "Unimplemented with Multiplexed Session"); + } + + @Override + public CommitResponse writeAtLeastOnceWithOptions( + Iterable mutations, TransactionOption... options) throws SpannerException { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.UNIMPLEMENTED, "Unimplemented with Multiplexed Session"); + } + + @Override + public ServerStream batchWriteAtLeastOnce( + Iterable mutationGroups, TransactionOption... options) + throws SpannerException { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.UNIMPLEMENTED, "Unimplemented with Multiplexed Session"); + } + + @Override + public ReadContext singleUse() { + return delegate.singleUse(); + } + + @Override + public ReadContext singleUse(TimestampBound bound) { + return delegate.singleUse(bound); + } + + @Override + public ReadOnlyTransaction singleUseReadOnlyTransaction() { + return delegate.singleUseReadOnlyTransaction(); + } + + @Override + public ReadOnlyTransaction singleUseReadOnlyTransaction(TimestampBound bound) { + return delegate.singleUseReadOnlyTransaction(bound); + } + + @Override + public ReadOnlyTransaction readOnlyTransaction() { + return delegate.readOnlyTransaction(); + } + + @Override + public ReadOnlyTransaction readOnlyTransaction(TimestampBound bound) { + return delegate.readOnlyTransaction(bound); + } + + @Override + public TransactionRunner readWriteTransaction(TransactionOption... options) { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.UNIMPLEMENTED, "Unimplemented with Multiplexed Session"); + } + + @Override + public TransactionManager transactionManager(TransactionOption... options) { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.UNIMPLEMENTED, "Unimplemented with Multiplexed Session"); + } + + @Override + public AsyncRunner runAsync(TransactionOption... options) { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.UNIMPLEMENTED, "Unimplemented with Multiplexed Session"); + } + + @Override + public AsyncTransactionManagerImpl transactionManagerAsync(TransactionOption... options) { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.UNIMPLEMENTED, "Unimplemented with Multiplexed Session"); + } + + @Override + public long executePartitionedUpdate(Statement stmt, UpdateOption... options) { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.UNIMPLEMENTED, "Unimplemented with Multiplexed Session"); + } + + @Override + public String getName() { + return delegate.getName(); + } + + @Override + public void prepareReadWriteTransaction() { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.UNIMPLEMENTED, "Unimplemented with Multiplexed Session"); + } + + @Override + public void close() { + synchronized (lock) { + numMultiplexedSessionsReleased++; + if (lastException != null && isDatabaseOrInstanceNotFound(lastException)) { + SessionPool.this.resourceNotFoundException = + MoreObjects.firstNonNull( + SessionPool.this.resourceNotFoundException, + (ResourceNotFoundException) lastException); + } + } + } + + @Override + public ApiFuture asyncClose() { + close(); + return ApiFutures.immediateFuture(Empty.getDefaultInstance()); + } + } + private final class WaiterFuture extends ForwardingListenableFuture { private static final long MAX_SESSION_WAIT_TIMEOUT = 240_000L; private final SettableFuture waiter = SettableFuture.create(); @@ -2162,9 +2586,15 @@ enum Position { @GuardedBy("lock") private long numSessionsAcquired = 0; + @GuardedBy("lock") + private long numMultiplexedSessionsAcquired = 0; + @GuardedBy("lock") private long numSessionsReleased = 0; + @GuardedBy("lock") + private long numMultiplexedSessionsReleased = 0; + @GuardedBy("lock") private long numIdleSessionsRemoved = 0; @@ -2192,7 +2622,8 @@ enum Position { private final CountDownLatch waitOnMinSessionsLatch; private final SessionReplacementHandler pooledSessionReplacementHandler = new PooledSessionReplacementHandler(); - + private static final SessionReplacementHandler multiplexedSessionReplacementHandler = + new MultiplexedSessionReplacementHandler(); /** * Create a session pool with the given options and for the given database. It will also start * eagerly creating sessions if {@link SessionPoolOptions#getMinSessions()} is greater than 0. From 60712bda00aea180923d8ab19e8e1ed70728a4d5 Mon Sep 17 00:00:00 2001 From: Quynh Tran Date: Wed, 3 Apr 2024 17:45:26 +1100 Subject: [PATCH 28/47] Remove internal PG.OID getters. --- .../clirr-ignored-differences.xml | 32 +---------------- .../cloud/spanner/AbstractResultSet.java | 15 -------- .../cloud/spanner/AbstractStructReader.java | 36 ++++--------------- .../com/google/cloud/spanner/GrpcStruct.java | 18 ---------- .../java/com/google/cloud/spanner/Struct.java | 15 -------- .../java/com/google/cloud/spanner/Value.java | 29 ++------------- .../AbstractStructReaderTypesTest.java | 23 ++---------- .../com/google/cloud/spanner/ValueTest.java | 30 ++++++++-------- 8 files changed, 27 insertions(+), 171 deletions(-) diff --git a/google-cloud-spanner/clirr-ignored-differences.xml b/google-cloud-spanner/clirr-ignored-differences.xml index 95a38dae424..e97a5cc7527 100644 --- a/google-cloud-spanner/clirr-ignored-differences.xml +++ b/google-cloud-spanner/clirr-ignored-differences.xml @@ -193,36 +193,6 @@ java.util.List getPgJsonbList(java.lang.String)
- - 7012 - com/google/cloud/spanner/StructReader - long getPgOid(int) - - - 7012 - com/google/cloud/spanner/StructReader - long getPgOid(java.lang.String) - - - 7012 - com/google/cloud/spanner/StructReader - long[] getPgOidArray(int) - - - 7012 - com/google/cloud/spanner/StructReader - long[] getPgOidArray(java.lang.String) - - - 7012 - com/google/cloud/spanner/StructReader - java.util.List getPgOidList(int) - - - 7012 - com/google/cloud/spanner/StructReader - java.util.List getPgOidList(java.lang.String) - 7013 com/google/cloud/spanner/Value @@ -233,7 +203,7 @@ com/google/cloud/spanner/Value java.util.List getPgOidArray() - + 7012 com/google/cloud/spanner/StructReader diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java index cfb9856b117..2cf93fb92ec 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java @@ -400,11 +400,6 @@ protected String getPgJsonbInternal(int columnIndex) { return currRow().getPgJsonbInternal(columnIndex); } - @Override - protected long getPgOidInternal(int columnIndex) { - return currRow().getPgOidInternal(columnIndex); - } - @Override protected ByteArray getBytesInternal(int columnIndex) { return currRow().getBytesInternal(columnIndex); @@ -485,16 +480,6 @@ protected List getPgJsonbListInternal(int columnIndex) { return currRow().getJsonListInternal(columnIndex); } - @Override - protected long[] getPgOidArrayInternal(int columnIndex) { - return currRow().getPgOidArrayInternal(columnIndex); - } - - @Override - protected List getPgOidListInternal(int columnIndex) { - return currRow().getPgOidListInternal(columnIndex); - } - @Override protected List getBytesListInternal(int columnIndex) { return currRow().getBytesListInternal(columnIndex); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java index e6a29b1805f..d13c61aaf01 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java @@ -61,10 +61,6 @@ protected String getPgJsonbInternal(int columnIndex) { throw new UnsupportedOperationException("Not implemented"); } - protected long getPgOidInternal(int columnIndex) { - throw new UnsupportedOperationException("Not implemented"); - } - protected abstract ByteArray getBytesInternal(int columnIndex); protected abstract Timestamp getTimestampInternal(int columnIndex); @@ -126,14 +122,6 @@ protected List getPgJsonbListInternal(int columnIndex) { throw new UnsupportedOperationException("Not implemented"); } - protected long[] getPgOidArrayInternal(int columnIndex) { - throw new UnsupportedOperationException("Not implemented"); - } - - protected List getPgOidListInternal(int columnIndex) { - throw new UnsupportedOperationException("Not implemented"); - } - protected abstract List getBytesListInternal(int columnIndex); protected abstract List getTimestampListInternal(int columnIndex); @@ -179,18 +167,14 @@ public boolean getBoolean(String columnName) { public long getLong(int columnIndex) { checkNonNullOfCodes( columnIndex, Arrays.asList(Code.ENUM, Code.PG_OID, Code.INT64), columnIndex); - return getColumnType(columnIndex).getCode() == Code.PG_OID - ? getPgOidInternal(columnIndex) - : getLongInternal(columnIndex); + return getLongInternal(columnIndex); } @Override public long getLong(String columnName) { int columnIndex = getColumnIndex(columnName); checkNonNullOfCodes(columnIndex, Arrays.asList(Code.ENUM, Code.PG_OID, Code.INT64), columnName); - return getColumnType(columnIndex).getCode() == Code.PG_OID - ? getPgOidInternal(columnIndex) - : getLongInternal(columnIndex); + return getLongInternal(columnIndex); } @Override @@ -385,9 +369,7 @@ public long[] getLongArray(int columnIndex) { checkNonNullOfCodes(columnIndex, Collections.singletonList(Code.ARRAY), columnIndex); checkArrayElementType( columnIndex, Arrays.asList(Code.ENUM, Code.PG_OID, Code.INT64), columnIndex); - return getColumnType(columnIndex).getArrayElementType().getCode() == Code.PG_OID - ? getPgOidArrayInternal(columnIndex) - : getLongArrayInternal(columnIndex); + return getLongArrayInternal(columnIndex); } @Override @@ -396,9 +378,7 @@ public long[] getLongArray(String columnName) { checkNonNullOfCodes(columnIndex, Collections.singletonList(Code.ARRAY), columnName); checkArrayElementType( columnIndex, Arrays.asList(Code.ENUM, Code.PG_OID, Code.INT64), columnName); - return getColumnType(columnIndex).getArrayElementType().getCode() == Code.PG_OID - ? getPgOidArrayInternal(columnIndex) - : getLongArrayInternal(columnIndex); + return getLongArrayInternal(columnIndex); } @Override @@ -406,9 +386,7 @@ public List getLongList(int columnIndex) { checkNonNullOfCodes(columnIndex, Collections.singletonList(Code.ARRAY), columnIndex); checkArrayElementType( columnIndex, Arrays.asList(Code.ENUM, Code.PG_OID, Code.INT64), columnIndex); - return getColumnType(columnIndex).getArrayElementType().getCode() == Code.PG_OID - ? getPgOidListInternal(columnIndex) - : getLongListInternal(columnIndex); + return getLongListInternal(columnIndex); } @Override @@ -417,9 +395,7 @@ public List getLongList(String columnName) { checkNonNullOfCodes(columnIndex, Collections.singletonList(Code.ARRAY), columnName); checkArrayElementType( columnIndex, Arrays.asList(Code.ENUM, Code.PG_OID, Code.INT64), columnName); - return getColumnType(columnIndex).getArrayElementType().getCode() == Code.PG_OID - ? getPgOidListInternal(columnIndex) - : getLongListInternal(columnIndex); + return getLongListInternal(columnIndex); } @Override diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStruct.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStruct.java index 2d27642c414..852b9ed61a3 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStruct.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcStruct.java @@ -468,12 +468,6 @@ protected String getPgJsonbInternal(int columnIndex) { return (String) rowData.get(columnIndex); } - @Override - protected long getPgOidInternal(int columnIndex) { - ensureDecoded(columnIndex); - return (Long) rowData.get(columnIndex); - } - @Override protected ByteArray getBytesInternal(int columnIndex) { ensureDecoded(columnIndex); @@ -789,18 +783,6 @@ protected List getPgJsonbListInternal(int columnIndex) { return Collections.unmodifiableList((List) rowData.get(columnIndex)); } - @Override - protected Int64Array getPgOidListInternal(int columnIndex) { - ensureDecoded(columnIndex); - return (Int64Array) rowData.get(columnIndex); - } - - @Override - protected long[] getPgOidArrayInternal(int columnIndex) { - ensureDecoded(columnIndex); - return getPgOidListInternal(columnIndex).toPrimitiveArray(columnIndex); - } - @Override @SuppressWarnings("unchecked") // We know ARRAY produces a List. protected List getBytesListInternal(int columnIndex) { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Struct.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Struct.java index d54cf86090b..112ecc8120c 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Struct.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Struct.java @@ -211,11 +211,6 @@ protected String getPgJsonbInternal(int columnIndex) { return values.get(columnIndex).getPgJsonb(); } - @Override - protected long getPgOidInternal(int columnIndex) { - return values.get(columnIndex).getPgOid(); - } - @Override protected ByteArray getBytesInternal(int columnIndex) { return values.get(columnIndex).getBytes(); @@ -312,16 +307,6 @@ protected List getPgJsonbListInternal(int columnIndex) { return values.get(columnIndex).getPgJsonbArray(); } - @Override - protected long[] getPgOidArrayInternal(int columnIndex) { - return Longs.toArray(getPgOidListInternal(columnIndex)); - } - - @Override - protected List getPgOidListInternal(int columnIndex) { - return values.get(columnIndex).getPgOidArray(); - } - @Override protected List getBytesListInternal(int columnIndex) { return values.get(columnIndex).getBytesArray(); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java index c2c93334143..c2c851d6dd8 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java @@ -871,13 +871,6 @@ public String getPgJsonb() { throw new UnsupportedOperationException("Not implemented"); } - /** - * Returns the value of a {@code PG_OID}-typed instance. - * - * @throws IllegalStateException if {@code isNull()} or the value is not of the expected type - */ - public abstract long getPgOid(); - /** * Returns the value of a {@code PROTO}-typed instance. * @@ -997,14 +990,6 @@ public List getPgJsonbArray() { throw new UnsupportedOperationException("Not implemented"); } - /** - * Returns the value of an {@code ARRAY}-typed instance. While the returned list itself - * will never be {@code null}, elements of that list may be null. - * - * @throws IllegalStateException if {@code isNull()} or the value is not of the expected type - */ - public abstract List getPgOidArray(); - /** * Returns the value of an {@code ARRAY}-typed instance. While the returned list itself * will never be {@code null}, elements of that list may be null. @@ -1314,11 +1299,6 @@ public String getPgJsonb() { throw defaultGetter(Type.pgJsonb()); } - @Override - public long getPgOid() { - throw defaultGetter(Type.pgOid()); - } - @Override public ByteArray getBytes() { throw defaultGetter(Type.bytes()); @@ -1383,11 +1363,6 @@ public List getPgJsonbArray() { throw defaultGetter(Type.array(Type.pgJsonb())); } - @Override - public List getPgOidArray() { - throw defaultGetter(Type.array(Type.pgOid())); - } - @Override public List getBytesArray() { throw defaultGetter(Type.array(Type.bytes())); @@ -1923,7 +1898,7 @@ private PgOidImpl(boolean isNull, long value) { } @Override - public long getPgOid() { + public long getInt64() { checkNotNull(); return value; } @@ -2593,7 +2568,7 @@ private PgOidArrayImpl(boolean isNull, BitSet nulls, long[] values) { } @Override - public List getPgOidArray() { + public List getInt64Array() { return getArray(); } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java index 06c91fffe17..595bbcaf26a 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java @@ -88,11 +88,6 @@ protected String getPgJsonbInternal(int columnIndex) { return null; } - @Override - protected long getPgOidInternal(int columnIndex) { - return 0; - } - @Override protected ByteArray getBytesInternal(int columnIndex) { return null; @@ -184,16 +179,6 @@ protected List getPgJsonbListInternal(int columnIndex) { return null; } - @Override - protected long[] getPgOidArrayInternal(int columnIndex) { - return null; - } - - @Override - protected List getPgOidListInternal(int columnIndex) { - return null; - } - @Override protected List getBytesListInternal(int columnIndex) { return null; @@ -301,9 +286,7 @@ public static Collection parameters() { "getJson", Collections.singletonList("getValue") }, - { - Type.pgOid(), "getPgOidInternal", 123L, "getLong", Collections.singletonList("getValue") - }, + {Type.pgOid(), "getLongInternal", 123L, "getLong", Collections.singletonList("getValue")}, { Type.timestamp(), "getTimestampInternal", @@ -404,14 +387,14 @@ public static Collection parameters() { }, { Type.array(Type.pgOid()), - "getPgOidArrayInternal", + "getLongArrayInternal", new long[] {1, 2}, "getLongArray", Arrays.asList("getLongList", "getValue") }, { Type.array(Type.pgOid()), - "getPgOidListInternal", + "getLongListInternal", Arrays.asList(3L, 4L), "getLongList", Arrays.asList("getLongArray", "getValue") diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java index 04e060c25ee..92b63913fdb 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java @@ -619,7 +619,7 @@ public void testPgOid() { Value v = Value.pgOid(Long.valueOf(123)); assertThat(v.getType()).isEqualTo(Type.pgOid()); assertThat(v.isNull()).isFalse(); - assertThat(v.getPgOid()).isEqualTo(123); + assertThat(v.getInt64()).isEqualTo(123); assertThat(v.toString()).isEqualTo("123"); assertEquals("123", v.getAsString()); } @@ -630,7 +630,7 @@ public void testPgOidNull() { assertThat(v.getType()).isEqualTo(Type.pgOid()); assertThat(v.isNull()).isTrue(); assertThat(v.toString()).isEqualTo(NULL_STRING); - IllegalStateException e = assertThrows(IllegalStateException.class, v::getPgOid); + IllegalStateException e = assertThrows(IllegalStateException.class, v::getInt64); assertThat(e.getMessage()).contains("null value"); assertEquals("NULL", v.getAsString()); } @@ -1212,19 +1212,19 @@ public void testPgJsonbArrayTryGetFloat64Array() { } @Test - public void pgOidArray() { + public void testPgOidArray() { Value v = Value.pgOidArray(new long[] {1, 2}); assertThat(v.isNull()).isFalse(); - assertThat(v.getPgOidArray()).containsExactly(1L, 2L).inOrder(); + assertThat(v.getInt64Array()).containsExactly(1L, 2L).inOrder(); assertThat(v.toString()).isEqualTo("[1,2]"); assertEquals("[1,2]", v.getAsString()); } @Test - public void pgOidArrayRange() { + public void testPgOidArrayRange() { Value v = Value.pgOidArray(new long[] {1, 2, 3, 4, 5}, 1, 3); assertThat(v.isNull()).isFalse(); - assertThat(v.getPgOidArray()).containsExactly(2L, 3L, 4L).inOrder(); + assertThat(v.getInt64Array()).containsExactly(2L, 3L, 4L).inOrder(); assertThat(v.toString()).isEqualTo("[2,3,4]"); assertEquals("[2,3,4]", v.getAsString()); } @@ -1234,42 +1234,42 @@ public void pgOidArrayNull() { Value v = Value.pgOidArray((long[]) null); assertThat(v.isNull()).isTrue(); assertThat(v.toString()).isEqualTo(NULL_STRING); - IllegalStateException e = assertThrows(IllegalStateException.class, v::getPgOidArray); + IllegalStateException e = assertThrows(IllegalStateException.class, v::getInt64Array); assertThat(e.getMessage()).contains("null value"); assertEquals("NULL", v.getAsString()); } @Test - public void pgOidArrayWrapper() { + public void testPgOidArrayWrapper() { Value v = Value.pgOidArray(Arrays.asList(1L, null, 3L)); assertThat(v.isNull()).isFalse(); - assertThat(v.getPgOidArray()).containsExactly(1L, null, 3L).inOrder(); + assertThat(v.getInt64Array()).containsExactly(1L, null, 3L).inOrder(); assertThat(v.toString()).isEqualTo("[1,NULL,3]"); assertEquals("[1,NULL,3]", v.getAsString()); } @Test - public void pgOidArrayWrapperNull() { + public void testPgOidArrayWrapperNull() { Value v = Value.pgOidArray((Iterable) null); assertThat(v.isNull()).isTrue(); assertThat(v.toString()).isEqualTo(NULL_STRING); - IllegalStateException e = assertThrows(IllegalStateException.class, v::getPgOidArray); + IllegalStateException e = assertThrows(IllegalStateException.class, v::getInt64Array); assertThat(e.getMessage()).contains("null value"); assertEquals("NULL", v.getAsString()); } @Test - public void pgOidArrayTryGetBool() { + public void testPgOidArrayTryGetBool() { Value value = Value.pgOidArray(Collections.singletonList(1234L)); IllegalStateException e = assertThrows(IllegalStateException.class, value::getBool); assertThat(e.getMessage()).contains("Expected: BOOL actual: ARRAY>"); } @Test - public void pgOidArrayNullTryGetBool() { + public void testPgOidArrayNullTryGetBool() { Value value = Value.pgOidArray((Iterable) null); - IllegalStateException e = assertThrows(IllegalStateException.class, value::getBool); - assertThat(e.getMessage()).contains("Expected: BOOL actual: ARRAY>"); + IllegalStateException e = assertThrows(IllegalStateException.class, value::getBoolArray); + assertThat(e.getMessage()).contains("Expected: ARRAY actual: ARRAY>"); } @Test From 19fbdfbf36a474af867a72e8ed0c8e7a6e147dcf Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 28 Mar 2024 14:54:08 +0100 Subject: [PATCH 29/47] deps: update dependency com.google.cloud:google-cloud-monitoring to v3.39.0 (#2966) --- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 49c59dcb6f1..7cb098895e1 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -24,7 +24,7 @@ UTF-8 0.31.1 2.38.0 - 3.38.0 + 3.39.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 1f58eb127a4..e97800125fc 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -24,7 +24,7 @@ UTF-8 0.31.1 2.38.0 - 3.38.0 + 3.39.0 From f3f6113ebc8ea0212226b990c235710702f60808 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 28 Mar 2024 14:30:17 +0000 Subject: [PATCH 30/47] chore(main): release 6.62.1 (#2968) :robot: I have created a release *beep* *boop* --- ## [6.62.1](https://togithub.com/googleapis/java-spanner/compare/v6.62.0...v6.62.1) (2024-03-28) ### Dependencies * Update dependency com.google.cloud:google-cloud-monitoring to v3.39.0 ([#2966](https://togithub.com/googleapis/java-spanner/issues/2966)) ([a5cb1dd](https://togithub.com/googleapis/java-spanner/commit/a5cb1ddd065100497d9215eff30d57361d7e84de)) * Update dependency com.google.cloud:google-cloud-trace to v2.38.0 ([#2967](https://togithub.com/googleapis/java-spanner/issues/2967)) ([b2dc788](https://togithub.com/googleapis/java-spanner/commit/b2dc788d5a54244d83a192ecac894ff931f884c4)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please). --- CHANGELOG.md | 8 ++++++++ google-cloud-spanner-bom/pom.xml | 18 ++++++++--------- google-cloud-spanner-executor/pom.xml | 4 ++-- google-cloud-spanner/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- grpc-google-cloud-spanner-executor-v1/pom.xml | 4 ++-- grpc-google-cloud-spanner-v1/pom.xml | 4 ++-- pom.xml | 20 +++++++++---------- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- proto-google-cloud-spanner-v1/pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 20 +++++++++---------- 15 files changed, 58 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf6dc252e4a..ee3da44d653 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [6.62.1](https://github.com/googleapis/java-spanner/compare/v6.62.0...v6.62.1) (2024-03-28) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-monitoring to v3.39.0 ([#2966](https://github.com/googleapis/java-spanner/issues/2966)) ([a5cb1dd](https://github.com/googleapis/java-spanner/commit/a5cb1ddd065100497d9215eff30d57361d7e84de)) +* Update dependency com.google.cloud:google-cloud-trace to v2.38.0 ([#2967](https://github.com/googleapis/java-spanner/issues/2967)) ([b2dc788](https://github.com/googleapis/java-spanner/commit/b2dc788d5a54244d83a192ecac894ff931f884c4)) + ## [6.62.0](https://github.com/googleapis/java-spanner/compare/v6.61.0...v6.62.0) (2024-03-19) diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index 552c09656aa..939adc492ea 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner-bom - 6.62.1-SNAPSHOT + 6.62.1 pom com.google.cloud @@ -53,43 +53,43 @@ com.google.cloud google-cloud-spanner - 6.62.1-SNAPSHOT + 6.62.1 com.google.cloud google-cloud-spanner test-jar - 6.62.1-SNAPSHOT + 6.62.1 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.62.1-SNAPSHOT + 6.62.1 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.62.1-SNAPSHOT + 6.62.1 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.62.1-SNAPSHOT + 6.62.1 com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.62.1-SNAPSHOT + 6.62.1 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.62.1-SNAPSHOT + 6.62.1 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.62.1-SNAPSHOT + 6.62.1 diff --git a/google-cloud-spanner-executor/pom.xml b/google-cloud-spanner-executor/pom.xml index 17fbe99ec0c..2ddb93b5371 100644 --- a/google-cloud-spanner-executor/pom.xml +++ b/google-cloud-spanner-executor/pom.xml @@ -5,14 +5,14 @@ 4.0.0 com.google.cloud google-cloud-spanner-executor - 6.62.1-SNAPSHOT + 6.62.1 jar Google Cloud Spanner Executor com.google.cloud google-cloud-spanner-parent - 6.62.1-SNAPSHOT + 6.62.1 diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index d393523667c..c6959c55fd7 100644 --- a/google-cloud-spanner/pom.xml +++ b/google-cloud-spanner/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner - 6.62.1-SNAPSHOT + 6.62.1 jar Google Cloud Spanner https://github.com/googleapis/java-spanner @@ -11,7 +11,7 @@ com.google.cloud google-cloud-spanner-parent - 6.62.1-SNAPSHOT + 6.62.1 google-cloud-spanner diff --git a/grpc-google-cloud-spanner-admin-database-v1/pom.xml b/grpc-google-cloud-spanner-admin-database-v1/pom.xml index 2ca9a97a48e..97f85ab5fdc 100644 --- a/grpc-google-cloud-spanner-admin-database-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.62.1-SNAPSHOT + 6.62.1 grpc-google-cloud-spanner-admin-database-v1 GRPC library for grpc-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.62.1-SNAPSHOT + 6.62.1 diff --git a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml index 8c48c7f332d..0ab8b79b3e5 100644 --- a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.62.1-SNAPSHOT + 6.62.1 grpc-google-cloud-spanner-admin-instance-v1 GRPC library for grpc-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.62.1-SNAPSHOT + 6.62.1 diff --git a/grpc-google-cloud-spanner-executor-v1/pom.xml b/grpc-google-cloud-spanner-executor-v1/pom.xml index ee648c3d8c3..f04c003621b 100644 --- a/grpc-google-cloud-spanner-executor-v1/pom.xml +++ b/grpc-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.62.1-SNAPSHOT + 6.62.1 grpc-google-cloud-spanner-executor-v1 GRPC library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.62.1-SNAPSHOT + 6.62.1 diff --git a/grpc-google-cloud-spanner-v1/pom.xml b/grpc-google-cloud-spanner-v1/pom.xml index de603820479..fe934386b0d 100644 --- a/grpc-google-cloud-spanner-v1/pom.xml +++ b/grpc-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.62.1-SNAPSHOT + 6.62.1 grpc-google-cloud-spanner-v1 GRPC library for grpc-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.62.1-SNAPSHOT + 6.62.1 diff --git a/pom.xml b/pom.xml index 3f727352edc..4ff60c2b9e2 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-spanner-parent pom - 6.62.1-SNAPSHOT + 6.62.1 Google Cloud Spanner Parent https://github.com/googleapis/java-spanner @@ -61,47 +61,47 @@ com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.62.1-SNAPSHOT + 6.62.1 com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.62.1-SNAPSHOT + 6.62.1 com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.62.1-SNAPSHOT + 6.62.1 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.62.1-SNAPSHOT + 6.62.1 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.62.1-SNAPSHOT + 6.62.1 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.62.1-SNAPSHOT + 6.62.1 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.62.1-SNAPSHOT + 6.62.1 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.62.1-SNAPSHOT + 6.62.1 com.google.cloud google-cloud-spanner - 6.62.1-SNAPSHOT + 6.62.1 diff --git a/proto-google-cloud-spanner-admin-database-v1/pom.xml b/proto-google-cloud-spanner-admin-database-v1/pom.xml index 056f74268d3..3770eebaad2 100644 --- a/proto-google-cloud-spanner-admin-database-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.62.1-SNAPSHOT + 6.62.1 proto-google-cloud-spanner-admin-database-v1 PROTO library for proto-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.62.1-SNAPSHOT + 6.62.1 diff --git a/proto-google-cloud-spanner-admin-instance-v1/pom.xml b/proto-google-cloud-spanner-admin-instance-v1/pom.xml index 69e2ace8786..1ab3f6ec5d8 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.62.1-SNAPSHOT + 6.62.1 proto-google-cloud-spanner-admin-instance-v1 PROTO library for proto-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.62.1-SNAPSHOT + 6.62.1 diff --git a/proto-google-cloud-spanner-executor-v1/pom.xml b/proto-google-cloud-spanner-executor-v1/pom.xml index 91283ecb9e4..ed63e21ea3c 100644 --- a/proto-google-cloud-spanner-executor-v1/pom.xml +++ b/proto-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.62.1-SNAPSHOT + 6.62.1 proto-google-cloud-spanner-executor-v1 Proto library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.62.1-SNAPSHOT + 6.62.1 diff --git a/proto-google-cloud-spanner-v1/pom.xml b/proto-google-cloud-spanner-v1/pom.xml index ceb83bde59e..086d1659b70 100644 --- a/proto-google-cloud-spanner-v1/pom.xml +++ b/proto-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.62.1-SNAPSHOT + 6.62.1 proto-google-cloud-spanner-v1 PROTO library for proto-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.62.1-SNAPSHOT + 6.62.1 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index e97800125fc..4dfae5bcd5c 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -32,7 +32,7 @@ com.google.cloud google-cloud-spanner - 6.62.1-SNAPSHOT + 6.62.1 diff --git a/versions.txt b/versions.txt index 79dd5517204..8f703336abb 100644 --- a/versions.txt +++ b/versions.txt @@ -1,13 +1,13 @@ # Format: # module:released-version:current-version -proto-google-cloud-spanner-admin-instance-v1:6.62.0:6.62.1-SNAPSHOT -proto-google-cloud-spanner-v1:6.62.0:6.62.1-SNAPSHOT -proto-google-cloud-spanner-admin-database-v1:6.62.0:6.62.1-SNAPSHOT -grpc-google-cloud-spanner-v1:6.62.0:6.62.1-SNAPSHOT -grpc-google-cloud-spanner-admin-instance-v1:6.62.0:6.62.1-SNAPSHOT -grpc-google-cloud-spanner-admin-database-v1:6.62.0:6.62.1-SNAPSHOT -google-cloud-spanner:6.62.0:6.62.1-SNAPSHOT -google-cloud-spanner-executor:6.62.0:6.62.1-SNAPSHOT -proto-google-cloud-spanner-executor-v1:6.62.0:6.62.1-SNAPSHOT -grpc-google-cloud-spanner-executor-v1:6.62.0:6.62.1-SNAPSHOT +proto-google-cloud-spanner-admin-instance-v1:6.62.1:6.62.1 +proto-google-cloud-spanner-v1:6.62.1:6.62.1 +proto-google-cloud-spanner-admin-database-v1:6.62.1:6.62.1 +grpc-google-cloud-spanner-v1:6.62.1:6.62.1 +grpc-google-cloud-spanner-admin-instance-v1:6.62.1:6.62.1 +grpc-google-cloud-spanner-admin-database-v1:6.62.1:6.62.1 +google-cloud-spanner:6.62.1:6.62.1 +google-cloud-spanner-executor:6.62.1:6.62.1 +proto-google-cloud-spanner-executor-v1:6.62.1:6.62.1 +grpc-google-cloud-spanner-executor-v1:6.62.1:6.62.1 From 8ac2a16122bf093c32a98cadc302db16c367c370 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:14:17 +0000 Subject: [PATCH 31/47] chore(main): release 6.62.2-SNAPSHOT (#2983) :robot: I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please). --- google-cloud-spanner-bom/pom.xml | 18 ++++++++--------- google-cloud-spanner-executor/pom.xml | 4 ++-- google-cloud-spanner/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- grpc-google-cloud-spanner-executor-v1/pom.xml | 4 ++-- grpc-google-cloud-spanner-v1/pom.xml | 4 ++-- pom.xml | 20 +++++++++---------- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- proto-google-cloud-spanner-v1/pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 20 +++++++++---------- 14 files changed, 50 insertions(+), 50 deletions(-) diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index 939adc492ea..18e1b8680e5 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner-bom - 6.62.1 + 6.62.2-SNAPSHOT pom com.google.cloud @@ -53,43 +53,43 @@ com.google.cloud google-cloud-spanner - 6.62.1 + 6.62.2-SNAPSHOT com.google.cloud google-cloud-spanner test-jar - 6.62.1 + 6.62.2-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.62.1 + 6.62.2-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.62.1 + 6.62.2-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.62.1 + 6.62.2-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.62.1 + 6.62.2-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-v1 - 6.62.1 + 6.62.2-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.62.1 + 6.62.2-SNAPSHOT diff --git a/google-cloud-spanner-executor/pom.xml b/google-cloud-spanner-executor/pom.xml index 2ddb93b5371..f163b67618f 100644 --- a/google-cloud-spanner-executor/pom.xml +++ b/google-cloud-spanner-executor/pom.xml @@ -5,14 +5,14 @@ 4.0.0 com.google.cloud google-cloud-spanner-executor - 6.62.1 + 6.62.2-SNAPSHOT jar Google Cloud Spanner Executor com.google.cloud google-cloud-spanner-parent - 6.62.1 + 6.62.2-SNAPSHOT diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index c6959c55fd7..b9102aef691 100644 --- a/google-cloud-spanner/pom.xml +++ b/google-cloud-spanner/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner - 6.62.1 + 6.62.2-SNAPSHOT jar Google Cloud Spanner https://github.com/googleapis/java-spanner @@ -11,7 +11,7 @@ com.google.cloud google-cloud-spanner-parent - 6.62.1 + 6.62.2-SNAPSHOT google-cloud-spanner diff --git a/grpc-google-cloud-spanner-admin-database-v1/pom.xml b/grpc-google-cloud-spanner-admin-database-v1/pom.xml index 97f85ab5fdc..45e2e4ef867 100644 --- a/grpc-google-cloud-spanner-admin-database-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.62.1 + 6.62.2-SNAPSHOT grpc-google-cloud-spanner-admin-database-v1 GRPC library for grpc-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.62.1 + 6.62.2-SNAPSHOT diff --git a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml index 0ab8b79b3e5..3823c47d795 100644 --- a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.62.1 + 6.62.2-SNAPSHOT grpc-google-cloud-spanner-admin-instance-v1 GRPC library for grpc-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.62.1 + 6.62.2-SNAPSHOT diff --git a/grpc-google-cloud-spanner-executor-v1/pom.xml b/grpc-google-cloud-spanner-executor-v1/pom.xml index f04c003621b..559607c04c2 100644 --- a/grpc-google-cloud-spanner-executor-v1/pom.xml +++ b/grpc-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.62.1 + 6.62.2-SNAPSHOT grpc-google-cloud-spanner-executor-v1 GRPC library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.62.1 + 6.62.2-SNAPSHOT diff --git a/grpc-google-cloud-spanner-v1/pom.xml b/grpc-google-cloud-spanner-v1/pom.xml index fe934386b0d..ada78070399 100644 --- a/grpc-google-cloud-spanner-v1/pom.xml +++ b/grpc-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.62.1 + 6.62.2-SNAPSHOT grpc-google-cloud-spanner-v1 GRPC library for grpc-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.62.1 + 6.62.2-SNAPSHOT diff --git a/pom.xml b/pom.xml index 4ff60c2b9e2..0e51c1f2cf4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-spanner-parent pom - 6.62.1 + 6.62.2-SNAPSHOT Google Cloud Spanner Parent https://github.com/googleapis/java-spanner @@ -61,47 +61,47 @@ com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.62.1 + 6.62.2-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.62.1 + 6.62.2-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.62.1 + 6.62.2-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-v1 - 6.62.1 + 6.62.2-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.62.1 + 6.62.2-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.62.1 + 6.62.2-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.62.1 + 6.62.2-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.62.1 + 6.62.2-SNAPSHOT com.google.cloud google-cloud-spanner - 6.62.1 + 6.62.2-SNAPSHOT diff --git a/proto-google-cloud-spanner-admin-database-v1/pom.xml b/proto-google-cloud-spanner-admin-database-v1/pom.xml index 3770eebaad2..2e9cca5344a 100644 --- a/proto-google-cloud-spanner-admin-database-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.62.1 + 6.62.2-SNAPSHOT proto-google-cloud-spanner-admin-database-v1 PROTO library for proto-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.62.1 + 6.62.2-SNAPSHOT diff --git a/proto-google-cloud-spanner-admin-instance-v1/pom.xml b/proto-google-cloud-spanner-admin-instance-v1/pom.xml index 1ab3f6ec5d8..e8bd6a96863 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.62.1 + 6.62.2-SNAPSHOT proto-google-cloud-spanner-admin-instance-v1 PROTO library for proto-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.62.1 + 6.62.2-SNAPSHOT diff --git a/proto-google-cloud-spanner-executor-v1/pom.xml b/proto-google-cloud-spanner-executor-v1/pom.xml index ed63e21ea3c..001b5656f8b 100644 --- a/proto-google-cloud-spanner-executor-v1/pom.xml +++ b/proto-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.62.1 + 6.62.2-SNAPSHOT proto-google-cloud-spanner-executor-v1 Proto library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.62.1 + 6.62.2-SNAPSHOT diff --git a/proto-google-cloud-spanner-v1/pom.xml b/proto-google-cloud-spanner-v1/pom.xml index 086d1659b70..17f69574d51 100644 --- a/proto-google-cloud-spanner-v1/pom.xml +++ b/proto-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.62.1 + 6.62.2-SNAPSHOT proto-google-cloud-spanner-v1 PROTO library for proto-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.62.1 + 6.62.2-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 4dfae5bcd5c..274c9fcd7eb 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -32,7 +32,7 @@ com.google.cloud google-cloud-spanner - 6.62.1 + 6.62.2-SNAPSHOT diff --git a/versions.txt b/versions.txt index 8f703336abb..49d2f6914dc 100644 --- a/versions.txt +++ b/versions.txt @@ -1,13 +1,13 @@ # Format: # module:released-version:current-version -proto-google-cloud-spanner-admin-instance-v1:6.62.1:6.62.1 -proto-google-cloud-spanner-v1:6.62.1:6.62.1 -proto-google-cloud-spanner-admin-database-v1:6.62.1:6.62.1 -grpc-google-cloud-spanner-v1:6.62.1:6.62.1 -grpc-google-cloud-spanner-admin-instance-v1:6.62.1:6.62.1 -grpc-google-cloud-spanner-admin-database-v1:6.62.1:6.62.1 -google-cloud-spanner:6.62.1:6.62.1 -google-cloud-spanner-executor:6.62.1:6.62.1 -proto-google-cloud-spanner-executor-v1:6.62.1:6.62.1 -grpc-google-cloud-spanner-executor-v1:6.62.1:6.62.1 +proto-google-cloud-spanner-admin-instance-v1:6.62.1:6.62.2-SNAPSHOT +proto-google-cloud-spanner-v1:6.62.1:6.62.2-SNAPSHOT +proto-google-cloud-spanner-admin-database-v1:6.62.1:6.62.2-SNAPSHOT +grpc-google-cloud-spanner-v1:6.62.1:6.62.2-SNAPSHOT +grpc-google-cloud-spanner-admin-instance-v1:6.62.1:6.62.2-SNAPSHOT +grpc-google-cloud-spanner-admin-database-v1:6.62.1:6.62.2-SNAPSHOT +google-cloud-spanner:6.62.1:6.62.2-SNAPSHOT +google-cloud-spanner-executor:6.62.1:6.62.2-SNAPSHOT +proto-google-cloud-spanner-executor-v1:6.62.1:6.62.2-SNAPSHOT +grpc-google-cloud-spanner-executor-v1:6.62.1:6.62.2-SNAPSHOT From 231273ecd8e0be5021fe4596fe45e43b0f95afc7 Mon Sep 17 00:00:00 2001 From: dengwe1 <159199800+dengwe1@users.noreply.github.com> Date: Thu, 28 Mar 2024 11:53:46 -0700 Subject: [PATCH 32/47] feat: add support for transaction-level exclusion from change streams (#2959) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support for transaction-level exclusion from change streams * cleanup * refactor: introduce PartitionedUpdateOption * Revert "refactor: introduce PartitionedUpdateOption" This reverts commit 96b508b50c633bfc58cc20c1b47649bf91ff68aa. * Add error handling in DML update APIs where excludeTxnFromChangeStreams option is not applicable * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../com/google/cloud/spanner/Options.java | 40 ++ .../spanner/PartitionedDmlTransaction.java | 8 +- .../com/google/cloud/spanner/SessionImpl.java | 25 +- .../cloud/spanner/TransactionRunnerImpl.java | 50 ++- .../cloud/spanner/DatabaseClientImplTest.java | 396 ++++++++++++++++++ .../com/google/cloud/spanner/OptionsTest.java | 38 ++ 6 files changed, 534 insertions(+), 23 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Options.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Options.java index d5c95d0a5a5..3dbd0c1cda3 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Options.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Options.java @@ -61,6 +61,9 @@ public interface ReadOption {} public interface ReadQueryUpdateTransactionOption extends ReadOption, QueryOption, UpdateOption, TransactionOption {} + /** Marker interface to mark options applicable to Update and Write operations */ + public interface UpdateTransactionOption extends UpdateOption, TransactionOption {} + /** * Marker interface to mark options applicable to Create, Update and Delete operations in admin * API. @@ -108,6 +111,17 @@ public static TransactionOption commitStats() { public static TransactionOption optimisticLock() { return OPTIMISTIC_LOCK_OPTION; } + + /** + * Specifying this instructs the transaction to be excluded from being recorded in change streams + * with the DDL option `allow_txn_exclusion=true`. This does not exclude the transaction from + * being recorded in the change streams with the DDL option `allow_txn_exclusion` being false or + * unset. + */ + public static UpdateTransactionOption excludeTxnFromChangeStreams() { + return EXCLUDE_TXN_FROM_CHANGE_STREAMS_OPTION; + } + /** * Specifying this will cause the read to yield at most this many rows. This should be greater * than 0. @@ -281,6 +295,18 @@ void appendToOptions(Options options) { static final OptimisticLockOption OPTIMISTIC_LOCK_OPTION = new OptimisticLockOption(); + /** Option to request the transaction to be excluded from change streams. */ + static final class ExcludeTxnFromChangeStreamsOption extends InternalOption + implements UpdateTransactionOption { + @Override + void appendToOptions(Options options) { + options.withExcludeTxnFromChangeStreams = true; + } + } + + static final ExcludeTxnFromChangeStreamsOption EXCLUDE_TXN_FROM_CHANGE_STREAMS_OPTION = + new ExcludeTxnFromChangeStreamsOption(); + /** Option pertaining to flow control. */ static final class FlowControlOption extends InternalOption implements ReadAndQueryOption { final int prefetchChunks; @@ -405,6 +431,7 @@ void appendToOptions(Options options) { private String etag; private Boolean validateOnly; private Boolean withOptimisticLock; + private Boolean withExcludeTxnFromChangeStreams; private Boolean dataBoostEnabled; private DirectedReadOptions directedReadOptions; private DecodeMode decodeMode; @@ -508,6 +535,10 @@ Boolean withOptimisticLock() { return withOptimisticLock; } + Boolean withExcludeTxnFromChangeStreams() { + return withExcludeTxnFromChangeStreams; + } + boolean hasDataBoostEnabled() { return dataBoostEnabled != null; } @@ -571,6 +602,11 @@ public String toString() { if (withOptimisticLock != null) { b.append("withOptimisticLock: ").append(withOptimisticLock).append(' '); } + if (withExcludeTxnFromChangeStreams != null) { + b.append("withExcludeTxnFromChangeStreams: ") + .append(withExcludeTxnFromChangeStreams) + .append(' '); + } if (dataBoostEnabled != null) { b.append("dataBoostEnabled: ").append(dataBoostEnabled).append(' '); } @@ -616,6 +652,7 @@ public boolean equals(Object o) { && Objects.equals(etag(), that.etag()) && Objects.equals(validateOnly(), that.validateOnly()) && Objects.equals(withOptimisticLock(), that.withOptimisticLock()) + && Objects.equals(withExcludeTxnFromChangeStreams(), that.withExcludeTxnFromChangeStreams()) && Objects.equals(dataBoostEnabled(), that.dataBoostEnabled()) && Objects.equals(directedReadOptions(), that.directedReadOptions()); } @@ -662,6 +699,9 @@ public int hashCode() { if (withOptimisticLock != null) { result = 31 * result + withOptimisticLock.hashCode(); } + if (withExcludeTxnFromChangeStreams != null) { + result = 31 * result + withExcludeTxnFromChangeStreams.hashCode(); + } if (dataBoostEnabled != null) { result = 31 * result + dataBoostEnabled.hashCode(); } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/PartitionedDmlTransaction.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/PartitionedDmlTransaction.java index cabc270566c..d498bb232a1 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/PartitionedDmlTransaction.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/PartitionedDmlTransaction.java @@ -167,7 +167,7 @@ private ExecuteSqlRequest resumeOrRestartRequest( @VisibleForTesting ExecuteSqlRequest newTransactionRequestFrom(final Statement statement, final Options options) { - ByteString transactionId = initTransaction(); + ByteString transactionId = initTransaction(options); final TransactionSelector transactionSelector = TransactionSelector.newBuilder().setId(transactionId).build(); @@ -195,13 +195,15 @@ ExecuteSqlRequest newTransactionRequestFrom(final Statement statement, final Opt return builder.build(); } - private ByteString initTransaction() { + private ByteString initTransaction(final Options options) { final BeginTransactionRequest request = BeginTransactionRequest.newBuilder() .setSession(session.getName()) .setOptions( TransactionOptions.newBuilder() - .setPartitionedDml(TransactionOptions.PartitionedDml.getDefaultInstance())) + .setPartitionedDml(TransactionOptions.PartitionedDml.getDefaultInstance()) + .setExcludeTxnFromChangeStreams( + options.withExcludeTxnFromChangeStreams() == Boolean.TRUE)) .build(); Transaction tx = rpc.beginTransaction(request, session.getOptions(), true); if (tx.getId().isEmpty()) { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java index bea44abab3e..8c4a0068599 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java @@ -69,11 +69,16 @@ static void throwIfTransactionsPending() { } static TransactionOptions createReadWriteTransactionOptions(Options options) { + TransactionOptions.Builder transactionOptions = TransactionOptions.newBuilder(); + if (options.withExcludeTxnFromChangeStreams() == Boolean.TRUE) { + transactionOptions.setExcludeTxnFromChangeStreams(true); + } TransactionOptions.ReadWrite.Builder readWrite = TransactionOptions.ReadWrite.newBuilder(); if (options.withOptimisticLock() == Boolean.TRUE) { readWrite.setReadLockMode(TransactionOptions.ReadWrite.ReadLockMode.OPTIMISTIC); } - return TransactionOptions.newBuilder().setReadWrite(readWrite).build(); + transactionOptions.setReadWrite(readWrite); + return transactionOptions.build(); } /** @@ -209,10 +214,16 @@ public CommitResponse writeAtLeastOnceWithOptions( CommitRequest.newBuilder() .setSession(name) .setReturnCommitStats(options.withCommitStats()) - .addAllMutations(mutationsProto) - .setSingleUseTransaction( - TransactionOptions.newBuilder() - .setReadWrite(TransactionOptions.ReadWrite.getDefaultInstance())); + .addAllMutations(mutationsProto); + + TransactionOptions.Builder transactionOptionsBuilder = + TransactionOptions.newBuilder() + .setReadWrite(TransactionOptions.ReadWrite.getDefaultInstance()); + if (options.withExcludeTxnFromChangeStreams() == Boolean.TRUE) { + transactionOptionsBuilder.setExcludeTxnFromChangeStreams(true); + } + requestBuilder.setSingleUseTransaction(transactionOptionsBuilder); + if (options.hasMaxCommitDelay()) { requestBuilder.setMaxCommitDelay( Duration.newBuilder() @@ -266,6 +277,10 @@ public ServerStream batchWriteAtLeastOnce( if (batchWriteRequestOptions != null) { requestBuilder.setRequestOptions(batchWriteRequestOptions); } + if (Options.fromTransactionOptions(transactionOptions).withExcludeTxnFromChangeStreams() + == Boolean.TRUE) { + requestBuilder.setExcludeTxnFromChangeStreams(true); + } ISpan span = tracer.spanBuilder(SpannerImpl.BATCH_WRITE); try (IScope s = tracer.withSpan(span)) { return spanner.getRpc().batchWriteAtLeastOnce(requestBuilder.build(), this.options); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java index 3249be1bdb3..370d2f662f5 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java @@ -76,6 +76,10 @@ class TransactionRunnerImpl implements SessionTransaction, TransactionRunner { private static final String TRANSACTION_ALREADY_COMMITTED_MESSAGE = "Transaction has already committed"; + private static final String DML_INVALID_EXCLUDE_CHANGE_STREAMS_OPTION_MESSAGE = + "Options.excludeTxnFromChangeStreams() cannot be specified for individual DML requests. " + + "This option should be set at the transaction level."; + @VisibleForTesting static class TransactionContextImpl extends AbstractReadContext implements TransactionContext { @@ -371,7 +375,9 @@ public void run() { if (transactionId == null && transactionIdFuture == null) { requestBuilder.setSingleUseTransaction( TransactionOptions.newBuilder() - .setReadWrite(TransactionOptions.ReadWrite.getDefaultInstance())); + .setReadWrite(TransactionOptions.ReadWrite.getDefaultInstance()) + .setExcludeTxnFromChangeStreams( + options.withExcludeTxnFromChangeStreams() == Boolean.TRUE)); } else { requestBuilder.setTransactionId( transactionId == null @@ -725,14 +731,16 @@ public long executeUpdate(Statement statement, UpdateOption... options) { } private ResultSet internalExecuteUpdate( - Statement statement, QueryMode queryMode, UpdateOption... options) { + Statement statement, QueryMode queryMode, UpdateOption... updateOptions) { beforeReadOrQuery(); + final Options options = Options.fromUpdateOptions(updateOptions); + if (options.withExcludeTxnFromChangeStreams() != null) { + throw newSpannerException( + ErrorCode.INVALID_ARGUMENT, DML_INVALID_EXCLUDE_CHANGE_STREAMS_OPTION_MESSAGE); + } final ExecuteSqlRequest.Builder builder = getExecuteSqlRequestBuilder( - statement, - queryMode, - Options.fromUpdateOptions(options), - /* withTransactionSelector = */ true); + statement, queryMode, options, /* withTransactionSelector = */ true); try { com.google.spanner.v1.ResultSet resultSet = rpc.executeQuery(builder.build(), session.getOptions(), isRouteToLeader()); @@ -753,14 +761,16 @@ private ResultSet internalExecuteUpdate( } @Override - public ApiFuture executeUpdateAsync(Statement statement, UpdateOption... options) { + public ApiFuture executeUpdateAsync(Statement statement, UpdateOption... updateOptions) { beforeReadOrQuery(); + final Options options = Options.fromUpdateOptions(updateOptions); + if (options.withExcludeTxnFromChangeStreams() != null) { + throw newSpannerException( + ErrorCode.INVALID_ARGUMENT, DML_INVALID_EXCLUDE_CHANGE_STREAMS_OPTION_MESSAGE); + } final ExecuteSqlRequest.Builder builder = getExecuteSqlRequestBuilder( - statement, - QueryMode.NORMAL, - Options.fromUpdateOptions(options), - /* withTransactionSelector = */ true); + statement, QueryMode.NORMAL, options, /* withTransactionSelector = */ true); final ApiFuture resultSet; try { // Register the update as an async operation that must finish before the transaction may @@ -832,10 +842,15 @@ private SpannerException createAbortedExceptionForBatchDml(ExecuteBatchDmlRespon } @Override - public long[] batchUpdate(Iterable statements, UpdateOption... options) { + public long[] batchUpdate(Iterable statements, UpdateOption... updateOptions) { beforeReadOrQuery(); + final Options options = Options.fromUpdateOptions(updateOptions); + if (options.withExcludeTxnFromChangeStreams() != null) { + throw newSpannerException( + ErrorCode.INVALID_ARGUMENT, DML_INVALID_EXCLUDE_CHANGE_STREAMS_OPTION_MESSAGE); + } final ExecuteBatchDmlRequest.Builder builder = - getExecuteBatchDmlRequestBuilder(statements, Options.fromUpdateOptions(options)); + getExecuteBatchDmlRequestBuilder(statements, options); try { com.google.spanner.v1.ExecuteBatchDmlResponse response = rpc.executeBatchDml(builder.build(), session.getOptions()); @@ -869,10 +884,15 @@ public long[] batchUpdate(Iterable statements, UpdateOption... option @Override public ApiFuture batchUpdateAsync( - Iterable statements, UpdateOption... options) { + Iterable statements, UpdateOption... updateOptions) { beforeReadOrQuery(); + final Options options = Options.fromUpdateOptions(updateOptions); + if (options.withExcludeTxnFromChangeStreams() != null) { + throw newSpannerException( + ErrorCode.INVALID_ARGUMENT, DML_INVALID_EXCLUDE_CHANGE_STREAMS_OPTION_MESSAGE); + } final ExecuteBatchDmlRequest.Builder builder = - getExecuteBatchDmlRequestBuilder(statements, Options.fromUpdateOptions(options)); + getExecuteBatchDmlRequestBuilder(statements, options); ApiFuture response; try { // Register the update as an async operation that must finish before the transaction may diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java index 24fa402d41f..057d85bb346 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java @@ -75,6 +75,7 @@ import com.google.rpc.RetryInfo; import com.google.spanner.v1.BatchWriteRequest; import com.google.spanner.v1.BatchWriteResponse; +import com.google.spanner.v1.BeginTransactionRequest; import com.google.spanner.v1.CommitRequest; import com.google.spanner.v1.DeleteSessionRequest; import com.google.spanner.v1.DirectedReadOptions; @@ -1334,6 +1335,14 @@ public void testWrite() { Mutation.newInsertBuilder("FOO").set("ID").to(1L).set("NAME").to("Bar").build())); assertNotNull(timestamp); + List beginTransactions = + mockSpanner.getRequestsOfType(BeginTransactionRequest.class); + assertThat(beginTransactions).hasSize(1); + BeginTransactionRequest beginTransaction = beginTransactions.get(0); + assertNotNull(beginTransaction.getOptions()); + assertTrue(beginTransaction.getOptions().hasReadWrite()); + assertFalse(beginTransaction.getOptions().getExcludeTxnFromChangeStreams()); + List commitRequests = mockSpanner.getRequestsOfType(CommitRequest.class); assertThat(commitRequests).hasSize(1); CommitRequest commit = commitRequests.get(0); @@ -1388,6 +1397,14 @@ public void testWriteWithOptions() { Mutation.newInsertBuilder("FOO").set("ID").to(1L).set("NAME").to("Bar").build()), Options.priority(RpcPriority.HIGH)); + List beginTransactions = + mockSpanner.getRequestsOfType(BeginTransactionRequest.class); + assertThat(beginTransactions).hasSize(1); + BeginTransactionRequest beginTransaction = beginTransactions.get(0); + assertNotNull(beginTransaction.getOptions()); + assertTrue(beginTransaction.getOptions().hasReadWrite()); + assertFalse(beginTransaction.getOptions().getExcludeTxnFromChangeStreams()); + List commits = mockSpanner.getRequestsOfType(CommitRequest.class); assertThat(commits).hasSize(1); CommitRequest commit = commits.get(0); @@ -1409,6 +1426,24 @@ public void testWriteWithCommitStats() { assertNotNull(response.getCommitStats()); } + @Test + public void testWriteWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + client.writeWithOptions( + Collections.singletonList( + Mutation.newInsertBuilder("FOO").set("ID").to(1L).set("NAME").to("Bar").build()), + Options.excludeTxnFromChangeStreams()); + + List beginTransactions = + mockSpanner.getRequestsOfType(BeginTransactionRequest.class); + assertThat(beginTransactions).hasSize(1); + BeginTransactionRequest beginTransaction = beginTransactions.get(0); + assertNotNull(beginTransaction.getOptions()); + assertTrue(beginTransaction.getOptions().hasReadWrite()); + assertTrue(beginTransaction.getOptions().getExcludeTxnFromChangeStreams()); + } + @Test public void testWriteAtLeastOnce() { DatabaseClient client = @@ -1418,6 +1453,15 @@ public void testWriteAtLeastOnce() { Collections.singletonList( Mutation.newInsertBuilder("FOO").set("ID").to(1L).set("NAME").to("Bar").build())); assertNotNull(timestamp); + + List commitRequests = mockSpanner.getRequestsOfType(CommitRequest.class); + assertThat(commitRequests).hasSize(1); + CommitRequest commit = commitRequests.get(0); + assertNotNull(commit.getSingleUseTransaction()); + assertTrue(commit.getSingleUseTransaction().hasReadWrite()); + assertFalse(commit.getSingleUseTransaction().getExcludeTxnFromChangeStreams()); + assertNotNull(commit.getRequestOptions()); + assertEquals(Priority.PRIORITY_UNSPECIFIED, commit.getRequestOptions().getPriority()); } @Test @@ -1438,6 +1482,7 @@ public void testWriteAtLeastOnceWithCommitStats() { CommitRequest commit = commitRequests.get(0); assertNotNull(commit.getSingleUseTransaction()); assertTrue(commit.getSingleUseTransaction().hasReadWrite()); + assertFalse(commit.getSingleUseTransaction().getExcludeTxnFromChangeStreams()); assertNotNull(commit.getRequestOptions()); assertEquals(Priority.PRIORITY_UNSPECIFIED, commit.getRequestOptions().getPriority()); } @@ -1456,6 +1501,7 @@ public void testWriteAtLeastOnceWithOptions() { CommitRequest commit = commitRequests.get(0); assertNotNull(commit.getSingleUseTransaction()); assertTrue(commit.getSingleUseTransaction().hasReadWrite()); + assertFalse(commit.getSingleUseTransaction().getExcludeTxnFromChangeStreams()); assertNotNull(commit.getRequestOptions()); assertEquals(Priority.PRIORITY_LOW, commit.getRequestOptions().getPriority()); } @@ -1474,11 +1520,29 @@ public void testWriteAtLeastOnceWithTagOptions() { CommitRequest commit = commitRequests.get(0); assertNotNull(commit.getSingleUseTransaction()); assertTrue(commit.getSingleUseTransaction().hasReadWrite()); + assertFalse(commit.getSingleUseTransaction().getExcludeTxnFromChangeStreams()); assertNotNull(commit.getRequestOptions()); assertThat(commit.getRequestOptions().getTransactionTag()).isEqualTo("app=spanner,env=test"); assertThat(commit.getRequestOptions().getRequestTag()).isEmpty(); } + @Test + public void testWriteAtLeastOnceWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + client.writeAtLeastOnceWithOptions( + Collections.singletonList( + Mutation.newInsertBuilder("FOO").set("ID").to(1L).set("NAME").to("Bar").build()), + Options.excludeTxnFromChangeStreams()); + + List commitRequests = mockSpanner.getRequestsOfType(CommitRequest.class); + assertThat(commitRequests).hasSize(1); + CommitRequest commit = commitRequests.get(0); + assertNotNull(commit.getSingleUseTransaction()); + assertTrue(commit.getSingleUseTransaction().hasReadWrite()); + assertTrue(commit.getSingleUseTransaction().getExcludeTxnFromChangeStreams()); + } + @Test public void testBatchWriteAtLeastOnceWithoutOptions() { DatabaseClient client = @@ -1500,6 +1564,7 @@ public void testBatchWriteAtLeastOnceWithoutOptions() { BatchWriteRequest request = requests.get(0); assertEquals(request.getMutationGroupsCount(), 4); assertEquals(request.getRequestOptions().getPriority(), Priority.PRIORITY_UNSPECIFIED); + assertFalse(request.getExcludeTxnFromChangeStreams()); } @Test @@ -1514,6 +1579,7 @@ public void testBatchWriteAtLeastOnceWithOptions() { BatchWriteRequest request = requests.get(0); assertEquals(request.getMutationGroupsCount(), 4); assertEquals(request.getRequestOptions().getPriority(), Priority.PRIORITY_LOW); + assertFalse(request.getExcludeTxnFromChangeStreams()); } @Test @@ -1529,6 +1595,21 @@ public void testBatchWriteAtLeastOnceWithTagOptions() { assertEquals(request.getMutationGroupsCount(), 4); assertEquals(request.getRequestOptions().getTransactionTag(), "app=spanner,env=test"); assertThat(request.getRequestOptions().getRequestTag()).isEmpty(); + assertFalse(request.getExcludeTxnFromChangeStreams()); + } + + @Test + public void testBatchWriteAtLeastOnceWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + consumeBatchWriteStream( + client.batchWriteAtLeastOnce(MUTATION_GROUPS, Options.excludeTxnFromChangeStreams())); + + List requests = mockSpanner.getRequestsOfType(BatchWriteRequest.class); + assertEquals(requests.size(), 1); + BatchWriteRequest request = requests.get(0); + assertEquals(request.getMutationGroupsCount(), 4); + assertTrue(request.getExcludeTxnFromChangeStreams()); } @Test @@ -1782,6 +1863,9 @@ public void testExecuteUpdateWithTag() { assertThat(request.getRequestOptions().getRequestTag()) .isEqualTo("app=spanner,env=test,action=update"); assertThat(request.getRequestOptions().getTransactionTag()).isEmpty(); + assertNotNull(request.getTransaction().getBegin()); + assertTrue(request.getTransaction().getBegin().hasReadWrite()); + assertFalse(request.getTransaction().getBegin().getExcludeTxnFromChangeStreams()); } @Test @@ -1805,6 +1889,9 @@ public void testBatchUpdateWithTag() { .isEqualTo("app=spanner,env=test,action=batch"); assertThat(request.getRequestOptions().getTransactionTag()) .isEqualTo("app=spanner,env=test,action=txn"); + assertNotNull(request.getTransaction().getBegin()); + assertTrue(request.getTransaction().getBegin().hasReadWrite()); + assertFalse(request.getTransaction().getBegin().getExcludeTxnFromChangeStreams()); } @Test @@ -1814,6 +1901,14 @@ public void testPartitionedDMLWithTag() { client.executePartitionedUpdate( UPDATE_STATEMENT, Options.tag("app=spanner,env=test,action=dml")); + List beginTransactions = + mockSpanner.getRequestsOfType(BeginTransactionRequest.class); + assertThat(beginTransactions).hasSize(1); + BeginTransactionRequest beginTransaction = beginTransactions.get(0); + assertNotNull(beginTransaction.getOptions()); + assertTrue(beginTransaction.getOptions().hasPartitionedDml()); + assertFalse(beginTransaction.getOptions().getExcludeTxnFromChangeStreams()); + List requests = mockSpanner.getRequestsOfType(ExecuteSqlRequest.class); assertThat(requests).hasSize(1); ExecuteSqlRequest request = requests.get(0); @@ -1835,6 +1930,14 @@ public void testCommitWithTag() { return null; }); + List beginTransactions = + mockSpanner.getRequestsOfType(BeginTransactionRequest.class); + assertThat(beginTransactions).hasSize(1); + BeginTransactionRequest beginTransaction = beginTransactions.get(0); + assertNotNull(beginTransaction.getOptions()); + assertTrue(beginTransaction.getOptions().hasReadWrite()); + assertFalse(beginTransaction.getOptions().getExcludeTxnFromChangeStreams()); + List requests = mockSpanner.getRequestsOfType(CommitRequest.class); assertThat(requests).hasSize(1); CommitRequest request = requests.get(0); @@ -1855,6 +1958,14 @@ public void testTransactionManagerCommitWithTag() { manager.commit(); } + List beginTransactions = + mockSpanner.getRequestsOfType(BeginTransactionRequest.class); + assertThat(beginTransactions).hasSize(1); + BeginTransactionRequest beginTransaction = beginTransactions.get(0); + assertNotNull(beginTransaction.getOptions()); + assertTrue(beginTransaction.getOptions().hasReadWrite()); + assertFalse(beginTransaction.getOptions().getExcludeTxnFromChangeStreams()); + List requests = mockSpanner.getRequestsOfType(CommitRequest.class); assertThat(requests).hasSize(1); CommitRequest request = requests.get(0); @@ -1877,6 +1988,14 @@ public void testAsyncRunnerCommitWithTag() { }, executor)); + List beginTransactions = + mockSpanner.getRequestsOfType(BeginTransactionRequest.class); + assertThat(beginTransactions).hasSize(1); + BeginTransactionRequest beginTransaction = beginTransactions.get(0); + assertNotNull(beginTransaction.getOptions()); + assertTrue(beginTransaction.getOptions().hasReadWrite()); + assertFalse(beginTransaction.getOptions().getExcludeTxnFromChangeStreams()); + List requests = mockSpanner.getRequestsOfType(CommitRequest.class); assertThat(requests).hasSize(1); CommitRequest request = requests.get(0); @@ -1904,6 +2023,14 @@ public void testAsyncTransactionManagerCommitWithTag() { .commitAsync()); } + List beginTransactions = + mockSpanner.getRequestsOfType(BeginTransactionRequest.class); + assertThat(beginTransactions).hasSize(1); + BeginTransactionRequest beginTransaction = beginTransactions.get(0); + assertNotNull(beginTransaction.getOptions()); + assertTrue(beginTransaction.getOptions().hasReadWrite()); + assertFalse(beginTransaction.getOptions().getExcludeTxnFromChangeStreams()); + List requests = mockSpanner.getRequestsOfType(CommitRequest.class); assertThat(requests).hasSize(1); CommitRequest request = requests.get(0); @@ -1913,6 +2040,275 @@ public void testAsyncTransactionManagerCommitWithTag() { .isEqualTo("app=spanner,env=test,action=manager"); } + @Test + public void testReadWriteTxnWithExcludeTxnFromChangeStreams_executeUpdate() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + TransactionRunner runner = client.readWriteTransaction(Options.excludeTxnFromChangeStreams()); + runner.run(transaction -> transaction.executeUpdate(UPDATE_STATEMENT)); + + List requests = mockSpanner.getRequestsOfType(ExecuteSqlRequest.class); + assertThat(requests).hasSize(1); + ExecuteSqlRequest request = requests.get(0); + assertNotNull(request.getTransaction().getBegin()); + assertTrue(request.getTransaction().getBegin().hasReadWrite()); + assertTrue(request.getTransaction().getBegin().getExcludeTxnFromChangeStreams()); + } + + @Test + public void testReadWriteTxnWithExcludeTxnFromChangeStreams_batchUpdate() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + TransactionRunner runner = client.readWriteTransaction(Options.excludeTxnFromChangeStreams()); + runner.run(transaction -> transaction.batchUpdate(Collections.singletonList(UPDATE_STATEMENT))); + + List requests = + mockSpanner.getRequestsOfType(ExecuteBatchDmlRequest.class); + assertThat(requests).hasSize(1); + ExecuteBatchDmlRequest request = requests.get(0); + assertNotNull(request.getTransaction().getBegin()); + assertTrue(request.getTransaction().getBegin().hasReadWrite()); + assertTrue(request.getTransaction().getBegin().getExcludeTxnFromChangeStreams()); + } + + @Test + public void testPartitionedDMLWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + client.executePartitionedUpdate(UPDATE_STATEMENT, Options.excludeTxnFromChangeStreams()); + + List beginTransactions = + mockSpanner.getRequestsOfType(BeginTransactionRequest.class); + assertThat(beginTransactions).hasSize(1); + BeginTransactionRequest beginTransaction = beginTransactions.get(0); + assertNotNull(beginTransaction.getOptions()); + assertTrue(beginTransaction.getOptions().hasPartitionedDml()); + assertTrue(beginTransaction.getOptions().getExcludeTxnFromChangeStreams()); + } + + @Test + public void testCommitWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + TransactionRunner runner = client.readWriteTransaction(Options.excludeTxnFromChangeStreams()); + runner.run( + transaction -> { + transaction.buffer(Mutation.delete("TEST", KeySet.all())); + return null; + }); + + List beginTransactions = + mockSpanner.getRequestsOfType(BeginTransactionRequest.class); + assertThat(beginTransactions).hasSize(1); + BeginTransactionRequest beginTransaction = beginTransactions.get(0); + assertNotNull(beginTransaction.getOptions()); + assertTrue(beginTransaction.getOptions().hasReadWrite()); + assertTrue(beginTransaction.getOptions().getExcludeTxnFromChangeStreams()); + } + + @Test + public void testTransactionManagerCommitWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + try (TransactionManager manager = + client.transactionManager(Options.excludeTxnFromChangeStreams())) { + TransactionContext transaction = manager.begin(); + transaction.buffer(Mutation.delete("TEST", KeySet.all())); + manager.commit(); + } + + List beginTransactions = + mockSpanner.getRequestsOfType(BeginTransactionRequest.class); + assertThat(beginTransactions).hasSize(1); + BeginTransactionRequest beginTransaction = beginTransactions.get(0); + assertNotNull(beginTransaction.getOptions()); + assertTrue(beginTransaction.getOptions().hasReadWrite()); + assertTrue(beginTransaction.getOptions().getExcludeTxnFromChangeStreams()); + } + + @Test + public void testAsyncRunnerCommitWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + AsyncRunner runner = client.runAsync(Options.excludeTxnFromChangeStreams()); + get( + runner.runAsync( + txn -> { + txn.buffer(Mutation.delete("TEST", KeySet.all())); + return ApiFutures.immediateFuture(null); + }, + executor)); + + List beginTransactions = + mockSpanner.getRequestsOfType(BeginTransactionRequest.class); + assertThat(beginTransactions).hasSize(1); + BeginTransactionRequest beginTransaction = beginTransactions.get(0); + assertNotNull(beginTransaction.getOptions()); + assertTrue(beginTransaction.getOptions().hasReadWrite()); + assertTrue(beginTransaction.getOptions().getExcludeTxnFromChangeStreams()); + } + + @Test + public void testAsyncTransactionManagerCommitWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + try (AsyncTransactionManager manager = + client.transactionManagerAsync(Options.excludeTxnFromChangeStreams())) { + TransactionContextFuture transaction = manager.beginAsync(); + get( + transaction + .then( + (txn, input) -> { + txn.buffer(Mutation.delete("TEST", KeySet.all())); + return ApiFutures.immediateFuture(null); + }, + executor) + .commitAsync()); + } + + List beginTransactions = + mockSpanner.getRequestsOfType(BeginTransactionRequest.class); + assertThat(beginTransactions).hasSize(1); + BeginTransactionRequest beginTransaction = beginTransactions.get(0); + assertNotNull(beginTransaction.getOptions()); + assertTrue(beginTransaction.getOptions().hasReadWrite()); + assertTrue(beginTransaction.getOptions().getExcludeTxnFromChangeStreams()); + } + + @Test + public void testExecuteUpdateWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + TransactionRunner runner = client.readWriteTransaction(); + SpannerException e = + assertThrows( + SpannerException.class, + () -> + runner.run( + transaction -> + transaction.executeUpdate( + UPDATE_STATEMENT, Options.excludeTxnFromChangeStreams()))); + assertThat(e.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); + assertThat(e.getMessage()) + .contains( + "Options.excludeTxnFromChangeStreams() cannot be specified for individual DML requests." + + " This option should be set at the transaction level."); + } + + @Test + public void testExecuteUpdateAsyncWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + AsyncRunner runner = client.runAsync(); + SpannerException e = + assertThrows( + SpannerException.class, + () -> + get( + runner.runAsync( + txn -> { + txn.executeUpdateAsync( + UPDATE_STATEMENT, Options.excludeTxnFromChangeStreams()); + return ApiFutures.immediateFuture(null); + }, + executor))); + assertThat(e.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); + assertThat(e.getMessage()) + .contains( + "Options.excludeTxnFromChangeStreams() cannot be specified for individual DML requests." + + " This option should be set at the transaction level."); + } + + @Test + public void testAnalyzeUpdateWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + TransactionRunner runner = client.readWriteTransaction(); + SpannerException e = + assertThrows( + SpannerException.class, + () -> + runner.run( + transaction -> + transaction.analyzeUpdate( + UPDATE_STATEMENT, + QueryAnalyzeMode.PROFILE, + Options.excludeTxnFromChangeStreams()))); + assertThat(e.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); + assertThat(e.getMessage()) + .contains( + "Options.excludeTxnFromChangeStreams() cannot be specified for individual DML requests." + + " This option should be set at the transaction level."); + } + + @Test + public void testAnalyzeUpdateStatementWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + TransactionRunner runner = client.readWriteTransaction(); + SpannerException e = + assertThrows( + SpannerException.class, + () -> + runner.run( + transaction -> + transaction.analyzeUpdateStatement( + UPDATE_STATEMENT, + QueryAnalyzeMode.PROFILE, + Options.excludeTxnFromChangeStreams()))); + assertThat(e.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); + assertThat(e.getMessage()) + .contains( + "Options.excludeTxnFromChangeStreams() cannot be specified for individual DML requests." + + " This option should be set at the transaction level."); + } + + @Test + public void testBatchUpdateWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + TransactionRunner runner = client.readWriteTransaction(); + SpannerException e = + assertThrows( + SpannerException.class, + () -> + runner.run( + transaction -> + transaction.batchUpdate( + Collections.singletonList(UPDATE_STATEMENT), + Options.excludeTxnFromChangeStreams()))); + assertThat(e.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); + assertThat(e.getMessage()) + .contains( + "Options.excludeTxnFromChangeStreams() cannot be specified for individual DML requests." + + " This option should be set at the transaction level."); + } + + @Test + public void testBatchUpdateAsyncWithExcludeTxnFromChangeStreams() { + DatabaseClient client = + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + AsyncRunner runner = client.runAsync(); + SpannerException e = + assertThrows( + SpannerException.class, + () -> + get( + runner.runAsync( + txn -> { + txn.batchUpdateAsync( + Collections.singletonList(UPDATE_STATEMENT), + Options.excludeTxnFromChangeStreams()); + return ApiFutures.immediateFuture(null); + }, + executor))); + assertThat(e.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); + assertThat(e.getMessage()) + .contains( + "Options.excludeTxnFromChangeStreams() cannot be specified for individual DML requests." + + " This option should be set at the transaction level."); + } + @Test public void singleUse() { DatabaseClientImpl client = diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OptionsTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OptionsTest.java index e0bbf81f297..8c9a5d957e8 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OptionsTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OptionsTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; @@ -100,6 +101,7 @@ public void allOptionsAbsent() { assertThat(options.hasTag()).isFalse(); assertThat(options.hasDataBoostEnabled()).isFalse(); assertThat(options.hasDirectedReadOptions()).isFalse(); + assertNull(options.withExcludeTxnFromChangeStreams()); assertThat(options.toString()).isEqualTo(""); assertThat(options.equals(options)).isTrue(); assertThat(options.equals(null)).isFalse(); @@ -691,4 +693,40 @@ public void directedReadHashCode() { public void directedReadsNullNotAllowed() { assertThrows(NullPointerException.class, () -> Options.directedRead(null)); } + + @Test + public void transactionOptionsExcludeTxnFromChangeStreams() { + Options option1 = Options.fromTransactionOptions(Options.excludeTxnFromChangeStreams()); + Options option2 = Options.fromTransactionOptions(Options.excludeTxnFromChangeStreams()); + Options option3 = Options.fromTransactionOptions(); + + assertEquals(option1, option2); + assertEquals(option1.hashCode(), option2.hashCode()); + assertNotEquals(option1, option3); + assertNotEquals(option1.hashCode(), option3.hashCode()); + + assertTrue(option1.withExcludeTxnFromChangeStreams()); + assertThat(option1.toString()).contains("withExcludeTxnFromChangeStreams: true"); + + assertNull(option3.withExcludeTxnFromChangeStreams()); + assertThat(option3.toString()).doesNotContain("withExcludeTxnFromChangeStreams: true"); + } + + @Test + public void updateOptionsExcludeTxnFromChangeStreams() { + Options option1 = Options.fromUpdateOptions(Options.excludeTxnFromChangeStreams()); + Options option2 = Options.fromUpdateOptions(Options.excludeTxnFromChangeStreams()); + Options option3 = Options.fromUpdateOptions(); + + assertEquals(option1, option2); + assertEquals(option1.hashCode(), option2.hashCode()); + assertNotEquals(option1, option3); + assertNotEquals(option1.hashCode(), option3.hashCode()); + + assertTrue(option1.withExcludeTxnFromChangeStreams()); + assertThat(option1.toString()).contains("withExcludeTxnFromChangeStreams: true"); + + assertNull(option3.withExcludeTxnFromChangeStreams()); + assertThat(option3.toString()).doesNotContain("withExcludeTxnFromChangeStreams: true"); + } } From 80ade2edd852b0ed21cd144e8810f94d7b1dd8c3 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 29 Mar 2024 05:39:38 +0100 Subject: [PATCH 33/47] deps: update dependency com.google.cloud:google-cloud-trace to v2.39.0 (#2988) --- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 7cb098895e1..5c6618ee6b4 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -23,7 +23,7 @@ 1.8 UTF-8 0.31.1 - 2.38.0 + 2.39.0 3.39.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 274c9fcd7eb..bc38ecae8b0 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -23,7 +23,7 @@ 1.8 UTF-8 0.31.1 - 2.38.0 + 2.39.0 3.39.0 From ecb87e7707ee7771deb8835bf2e1cc9c8fb30d71 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 29 Mar 2024 05:40:42 +0100 Subject: [PATCH 34/47] deps: update dependency commons-io:commons-io to v2.16.0 (#2986) --- google-cloud-spanner-executor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud-spanner-executor/pom.xml b/google-cloud-spanner-executor/pom.xml index f163b67618f..5635c3a0ab1 100644 --- a/google-cloud-spanner-executor/pom.xml +++ b/google-cloud-spanner-executor/pom.xml @@ -134,7 +134,7 @@ commons-io commons-io - 2.15.1 + 2.16.0 From 7444b29382f5e1d63c4bd709516ae1031c93297d Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Sat, 30 Mar 2024 04:18:38 +0100 Subject: [PATCH 35/47] deps: update dependency com.google.cloud:google-cloud-monitoring to v3.40.0 (#2987) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * deps: update dependency com.google.cloud:google-cloud-monitoring to v3.40.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- README.md | 2 +- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 56d91c89705..df14a2fb3a5 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ If you are using Maven without the BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.34.0') +implementation platform('com.google.cloud:libraries-bom:26.35.0') implementation 'com.google.cloud:google-cloud-spanner' ``` diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 5c6618ee6b4..b3647430cac 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -24,7 +24,7 @@ UTF-8 0.31.1 2.39.0 - 3.39.0 + 3.40.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index bc38ecae8b0..85c21ea8e64 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -24,7 +24,7 @@ UTF-8 0.31.1 2.39.0 - 3.39.0 + 3.40.0 From 8a9584b372e8eed19a9b8019eb36153996da90d3 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Sat, 30 Mar 2024 04:19:07 +0100 Subject: [PATCH 36/47] chore(deps): update dependency com.google.cloud:libraries-bom to v26.35.0 (#2989) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update dependency com.google.cloud:libraries-bom to v26.35.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- README.md | 2 +- samples/native-image/pom.xml | 2 +- samples/snippets/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index df14a2fb3a5..723b796a9e6 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - 26.34.0 + 26.35.0 pom import diff --git a/samples/native-image/pom.xml b/samples/native-image/pom.xml index b009be4637d..c40930a15a8 100644 --- a/samples/native-image/pom.xml +++ b/samples/native-image/pom.xml @@ -29,7 +29,7 @@ com.google.cloud libraries-bom - 26.34.0 + 26.35.0 pom import diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 655c9195864..1698a1207aa 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -34,7 +34,7 @@ com.google.cloud libraries-bom - 26.34.0 + 26.35.0 pom import From f103f1893a5e633754666b83deb19b6c94e823dd Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Sat, 30 Mar 2024 10:22:03 +0530 Subject: [PATCH 37/47] chore(main): release 6.63.0 (#2985) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 14 +++++++++++++ google-cloud-spanner-bom/pom.xml | 18 ++++++++--------- google-cloud-spanner-executor/pom.xml | 4 ++-- google-cloud-spanner/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- grpc-google-cloud-spanner-executor-v1/pom.xml | 4 ++-- grpc-google-cloud-spanner-v1/pom.xml | 4 ++-- pom.xml | 20 +++++++++---------- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- proto-google-cloud-spanner-v1/pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 20 +++++++++---------- 15 files changed, 64 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee3da44d653..b43cabe3b12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [6.63.0](https://github.com/googleapis/java-spanner/compare/v6.62.1...v6.63.0) (2024-03-30) + + +### Features + +* Add support for transaction-level exclusion from change streams ([#2959](https://github.com/googleapis/java-spanner/issues/2959)) ([7ae376a](https://github.com/googleapis/java-spanner/commit/7ae376acea4dce7a0bb4565d6c9bfdbbb75146c6)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-monitoring to v3.40.0 ([#2987](https://github.com/googleapis/java-spanner/issues/2987)) ([0a1ffcb](https://github.com/googleapis/java-spanner/commit/0a1ffcb371bdee6e478e3aa53b0a4591055134e3)) +* Update dependency com.google.cloud:google-cloud-trace to v2.39.0 ([#2988](https://github.com/googleapis/java-spanner/issues/2988)) ([cf11641](https://github.com/googleapis/java-spanner/commit/cf116412d46c5047167d4dd60ef9c88c3d9c754b)) +* Update dependency commons-io:commons-io to v2.16.0 ([#2986](https://github.com/googleapis/java-spanner/issues/2986)) ([4697261](https://github.com/googleapis/java-spanner/commit/46972619f88018bad1b4e05526a618d38e2e0897)) + ## [6.62.1](https://github.com/googleapis/java-spanner/compare/v6.62.0...v6.62.1) (2024-03-28) diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index 18e1b8680e5..0e156cdde0d 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner-bom - 6.62.2-SNAPSHOT + 6.63.0 pom com.google.cloud @@ -53,43 +53,43 @@ com.google.cloud google-cloud-spanner - 6.62.2-SNAPSHOT + 6.63.0 com.google.cloud google-cloud-spanner test-jar - 6.62.2-SNAPSHOT + 6.63.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.62.2-SNAPSHOT + 6.63.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.62.2-SNAPSHOT + 6.63.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.62.2-SNAPSHOT + 6.63.0 com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.62.2-SNAPSHOT + 6.63.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.62.2-SNAPSHOT + 6.63.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.62.2-SNAPSHOT + 6.63.0 diff --git a/google-cloud-spanner-executor/pom.xml b/google-cloud-spanner-executor/pom.xml index 5635c3a0ab1..64b606e5a96 100644 --- a/google-cloud-spanner-executor/pom.xml +++ b/google-cloud-spanner-executor/pom.xml @@ -5,14 +5,14 @@ 4.0.0 com.google.cloud google-cloud-spanner-executor - 6.62.2-SNAPSHOT + 6.63.0 jar Google Cloud Spanner Executor com.google.cloud google-cloud-spanner-parent - 6.62.2-SNAPSHOT + 6.63.0 diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index b9102aef691..d471f46ae17 100644 --- a/google-cloud-spanner/pom.xml +++ b/google-cloud-spanner/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner - 6.62.2-SNAPSHOT + 6.63.0 jar Google Cloud Spanner https://github.com/googleapis/java-spanner @@ -11,7 +11,7 @@ com.google.cloud google-cloud-spanner-parent - 6.62.2-SNAPSHOT + 6.63.0 google-cloud-spanner diff --git a/grpc-google-cloud-spanner-admin-database-v1/pom.xml b/grpc-google-cloud-spanner-admin-database-v1/pom.xml index 45e2e4ef867..5c1af8f41b9 100644 --- a/grpc-google-cloud-spanner-admin-database-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.62.2-SNAPSHOT + 6.63.0 grpc-google-cloud-spanner-admin-database-v1 GRPC library for grpc-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.62.2-SNAPSHOT + 6.63.0 diff --git a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml index 3823c47d795..17fb51703b8 100644 --- a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.62.2-SNAPSHOT + 6.63.0 grpc-google-cloud-spanner-admin-instance-v1 GRPC library for grpc-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.62.2-SNAPSHOT + 6.63.0 diff --git a/grpc-google-cloud-spanner-executor-v1/pom.xml b/grpc-google-cloud-spanner-executor-v1/pom.xml index 559607c04c2..8f2a3b37db1 100644 --- a/grpc-google-cloud-spanner-executor-v1/pom.xml +++ b/grpc-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.62.2-SNAPSHOT + 6.63.0 grpc-google-cloud-spanner-executor-v1 GRPC library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.62.2-SNAPSHOT + 6.63.0 diff --git a/grpc-google-cloud-spanner-v1/pom.xml b/grpc-google-cloud-spanner-v1/pom.xml index ada78070399..892eaa734c9 100644 --- a/grpc-google-cloud-spanner-v1/pom.xml +++ b/grpc-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.62.2-SNAPSHOT + 6.63.0 grpc-google-cloud-spanner-v1 GRPC library for grpc-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.62.2-SNAPSHOT + 6.63.0 diff --git a/pom.xml b/pom.xml index 0e51c1f2cf4..cf1115a93fa 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-spanner-parent pom - 6.62.2-SNAPSHOT + 6.63.0 Google Cloud Spanner Parent https://github.com/googleapis/java-spanner @@ -61,47 +61,47 @@ com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.62.2-SNAPSHOT + 6.63.0 com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.62.2-SNAPSHOT + 6.63.0 com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.62.2-SNAPSHOT + 6.63.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.62.2-SNAPSHOT + 6.63.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.62.2-SNAPSHOT + 6.63.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.62.2-SNAPSHOT + 6.63.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.62.2-SNAPSHOT + 6.63.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.62.2-SNAPSHOT + 6.63.0 com.google.cloud google-cloud-spanner - 6.62.2-SNAPSHOT + 6.63.0 diff --git a/proto-google-cloud-spanner-admin-database-v1/pom.xml b/proto-google-cloud-spanner-admin-database-v1/pom.xml index 2e9cca5344a..d434fe8202c 100644 --- a/proto-google-cloud-spanner-admin-database-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.62.2-SNAPSHOT + 6.63.0 proto-google-cloud-spanner-admin-database-v1 PROTO library for proto-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.62.2-SNAPSHOT + 6.63.0 diff --git a/proto-google-cloud-spanner-admin-instance-v1/pom.xml b/proto-google-cloud-spanner-admin-instance-v1/pom.xml index e8bd6a96863..0ea8a45b2d7 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.62.2-SNAPSHOT + 6.63.0 proto-google-cloud-spanner-admin-instance-v1 PROTO library for proto-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.62.2-SNAPSHOT + 6.63.0 diff --git a/proto-google-cloud-spanner-executor-v1/pom.xml b/proto-google-cloud-spanner-executor-v1/pom.xml index 001b5656f8b..24c5fac07b1 100644 --- a/proto-google-cloud-spanner-executor-v1/pom.xml +++ b/proto-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.62.2-SNAPSHOT + 6.63.0 proto-google-cloud-spanner-executor-v1 Proto library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.62.2-SNAPSHOT + 6.63.0 diff --git a/proto-google-cloud-spanner-v1/pom.xml b/proto-google-cloud-spanner-v1/pom.xml index 17f69574d51..ceb0c5bf614 100644 --- a/proto-google-cloud-spanner-v1/pom.xml +++ b/proto-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.62.2-SNAPSHOT + 6.63.0 proto-google-cloud-spanner-v1 PROTO library for proto-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.62.2-SNAPSHOT + 6.63.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 85c21ea8e64..cb8ad86b626 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -32,7 +32,7 @@ com.google.cloud google-cloud-spanner - 6.62.2-SNAPSHOT + 6.63.0 diff --git a/versions.txt b/versions.txt index 49d2f6914dc..35f3118a473 100644 --- a/versions.txt +++ b/versions.txt @@ -1,13 +1,13 @@ # Format: # module:released-version:current-version -proto-google-cloud-spanner-admin-instance-v1:6.62.1:6.62.2-SNAPSHOT -proto-google-cloud-spanner-v1:6.62.1:6.62.2-SNAPSHOT -proto-google-cloud-spanner-admin-database-v1:6.62.1:6.62.2-SNAPSHOT -grpc-google-cloud-spanner-v1:6.62.1:6.62.2-SNAPSHOT -grpc-google-cloud-spanner-admin-instance-v1:6.62.1:6.62.2-SNAPSHOT -grpc-google-cloud-spanner-admin-database-v1:6.62.1:6.62.2-SNAPSHOT -google-cloud-spanner:6.62.1:6.62.2-SNAPSHOT -google-cloud-spanner-executor:6.62.1:6.62.2-SNAPSHOT -proto-google-cloud-spanner-executor-v1:6.62.1:6.62.2-SNAPSHOT -grpc-google-cloud-spanner-executor-v1:6.62.1:6.62.2-SNAPSHOT +proto-google-cloud-spanner-admin-instance-v1:6.63.0:6.63.0 +proto-google-cloud-spanner-v1:6.63.0:6.63.0 +proto-google-cloud-spanner-admin-database-v1:6.63.0:6.63.0 +grpc-google-cloud-spanner-v1:6.63.0:6.63.0 +grpc-google-cloud-spanner-admin-instance-v1:6.63.0:6.63.0 +grpc-google-cloud-spanner-admin-database-v1:6.63.0:6.63.0 +google-cloud-spanner:6.63.0:6.63.0 +google-cloud-spanner-executor:6.63.0:6.63.0 +proto-google-cloud-spanner-executor-v1:6.63.0:6.63.0 +grpc-google-cloud-spanner-executor-v1:6.63.0:6.63.0 From a8531fd308c80037a933e94466c3b102dca1da73 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Sat, 30 Mar 2024 05:24:16 +0000 Subject: [PATCH 38/47] chore(main): release 6.63.1-SNAPSHOT (#2991) :robot: I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please). --- google-cloud-spanner-bom/pom.xml | 18 ++++++++--------- google-cloud-spanner-executor/pom.xml | 4 ++-- google-cloud-spanner/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- grpc-google-cloud-spanner-executor-v1/pom.xml | 4 ++-- grpc-google-cloud-spanner-v1/pom.xml | 4 ++-- pom.xml | 20 +++++++++---------- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- proto-google-cloud-spanner-v1/pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 20 +++++++++---------- 14 files changed, 50 insertions(+), 50 deletions(-) diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index 0e156cdde0d..85f70e34611 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner-bom - 6.63.0 + 6.63.1-SNAPSHOT pom com.google.cloud @@ -53,43 +53,43 @@ com.google.cloud google-cloud-spanner - 6.63.0 + 6.63.1-SNAPSHOT com.google.cloud google-cloud-spanner test-jar - 6.63.0 + 6.63.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.63.0 + 6.63.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.63.0 + 6.63.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.63.0 + 6.63.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.63.0 + 6.63.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-v1 - 6.63.0 + 6.63.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.63.0 + 6.63.1-SNAPSHOT diff --git a/google-cloud-spanner-executor/pom.xml b/google-cloud-spanner-executor/pom.xml index 64b606e5a96..754465d8332 100644 --- a/google-cloud-spanner-executor/pom.xml +++ b/google-cloud-spanner-executor/pom.xml @@ -5,14 +5,14 @@ 4.0.0 com.google.cloud google-cloud-spanner-executor - 6.63.0 + 6.63.1-SNAPSHOT jar Google Cloud Spanner Executor com.google.cloud google-cloud-spanner-parent - 6.63.0 + 6.63.1-SNAPSHOT diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index d471f46ae17..d3e459a7f63 100644 --- a/google-cloud-spanner/pom.xml +++ b/google-cloud-spanner/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner - 6.63.0 + 6.63.1-SNAPSHOT jar Google Cloud Spanner https://github.com/googleapis/java-spanner @@ -11,7 +11,7 @@ com.google.cloud google-cloud-spanner-parent - 6.63.0 + 6.63.1-SNAPSHOT google-cloud-spanner diff --git a/grpc-google-cloud-spanner-admin-database-v1/pom.xml b/grpc-google-cloud-spanner-admin-database-v1/pom.xml index 5c1af8f41b9..ee51aec078f 100644 --- a/grpc-google-cloud-spanner-admin-database-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.63.0 + 6.63.1-SNAPSHOT grpc-google-cloud-spanner-admin-database-v1 GRPC library for grpc-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.63.0 + 6.63.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml index 17fb51703b8..a8b13860d0d 100644 --- a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.63.0 + 6.63.1-SNAPSHOT grpc-google-cloud-spanner-admin-instance-v1 GRPC library for grpc-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.63.0 + 6.63.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-executor-v1/pom.xml b/grpc-google-cloud-spanner-executor-v1/pom.xml index 8f2a3b37db1..c222c845653 100644 --- a/grpc-google-cloud-spanner-executor-v1/pom.xml +++ b/grpc-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.63.0 + 6.63.1-SNAPSHOT grpc-google-cloud-spanner-executor-v1 GRPC library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.63.0 + 6.63.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-v1/pom.xml b/grpc-google-cloud-spanner-v1/pom.xml index 892eaa734c9..ae485866b24 100644 --- a/grpc-google-cloud-spanner-v1/pom.xml +++ b/grpc-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.63.0 + 6.63.1-SNAPSHOT grpc-google-cloud-spanner-v1 GRPC library for grpc-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.63.0 + 6.63.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index cf1115a93fa..0aa134f33b5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-spanner-parent pom - 6.63.0 + 6.63.1-SNAPSHOT Google Cloud Spanner Parent https://github.com/googleapis/java-spanner @@ -61,47 +61,47 @@ com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.63.0 + 6.63.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.63.0 + 6.63.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.63.0 + 6.63.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-v1 - 6.63.0 + 6.63.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.63.0 + 6.63.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.63.0 + 6.63.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.63.0 + 6.63.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.63.0 + 6.63.1-SNAPSHOT com.google.cloud google-cloud-spanner - 6.63.0 + 6.63.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-admin-database-v1/pom.xml b/proto-google-cloud-spanner-admin-database-v1/pom.xml index d434fe8202c..9b42a92d1c8 100644 --- a/proto-google-cloud-spanner-admin-database-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.63.0 + 6.63.1-SNAPSHOT proto-google-cloud-spanner-admin-database-v1 PROTO library for proto-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.63.0 + 6.63.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-admin-instance-v1/pom.xml b/proto-google-cloud-spanner-admin-instance-v1/pom.xml index 0ea8a45b2d7..708d3b77f34 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.63.0 + 6.63.1-SNAPSHOT proto-google-cloud-spanner-admin-instance-v1 PROTO library for proto-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.63.0 + 6.63.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-executor-v1/pom.xml b/proto-google-cloud-spanner-executor-v1/pom.xml index 24c5fac07b1..d4d14f6d1ac 100644 --- a/proto-google-cloud-spanner-executor-v1/pom.xml +++ b/proto-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.63.0 + 6.63.1-SNAPSHOT proto-google-cloud-spanner-executor-v1 Proto library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.63.0 + 6.63.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-v1/pom.xml b/proto-google-cloud-spanner-v1/pom.xml index ceb0c5bf614..0afbd5b9501 100644 --- a/proto-google-cloud-spanner-v1/pom.xml +++ b/proto-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.63.0 + 6.63.1-SNAPSHOT proto-google-cloud-spanner-v1 PROTO library for proto-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.63.0 + 6.63.1-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index cb8ad86b626..3ac5d048dc7 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -32,7 +32,7 @@ com.google.cloud google-cloud-spanner - 6.63.0 + 6.63.1-SNAPSHOT diff --git a/versions.txt b/versions.txt index 35f3118a473..abf942b1a0d 100644 --- a/versions.txt +++ b/versions.txt @@ -1,13 +1,13 @@ # Format: # module:released-version:current-version -proto-google-cloud-spanner-admin-instance-v1:6.63.0:6.63.0 -proto-google-cloud-spanner-v1:6.63.0:6.63.0 -proto-google-cloud-spanner-admin-database-v1:6.63.0:6.63.0 -grpc-google-cloud-spanner-v1:6.63.0:6.63.0 -grpc-google-cloud-spanner-admin-instance-v1:6.63.0:6.63.0 -grpc-google-cloud-spanner-admin-database-v1:6.63.0:6.63.0 -google-cloud-spanner:6.63.0:6.63.0 -google-cloud-spanner-executor:6.63.0:6.63.0 -proto-google-cloud-spanner-executor-v1:6.63.0:6.63.0 -grpc-google-cloud-spanner-executor-v1:6.63.0:6.63.0 +proto-google-cloud-spanner-admin-instance-v1:6.63.0:6.63.1-SNAPSHOT +proto-google-cloud-spanner-v1:6.63.0:6.63.1-SNAPSHOT +proto-google-cloud-spanner-admin-database-v1:6.63.0:6.63.1-SNAPSHOT +grpc-google-cloud-spanner-v1:6.63.0:6.63.1-SNAPSHOT +grpc-google-cloud-spanner-admin-instance-v1:6.63.0:6.63.1-SNAPSHOT +grpc-google-cloud-spanner-admin-database-v1:6.63.0:6.63.1-SNAPSHOT +google-cloud-spanner:6.63.0:6.63.1-SNAPSHOT +google-cloud-spanner-executor:6.63.0:6.63.1-SNAPSHOT +proto-google-cloud-spanner-executor-v1:6.63.0:6.63.1-SNAPSHOT +grpc-google-cloud-spanner-executor-v1:6.63.0:6.63.1-SNAPSHOT From e74319c105508ab91a5d13152362d39b315c8dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Mon, 1 Apr 2024 12:04:12 +0200 Subject: [PATCH 39/47] chore: clean up some warnings and malformed comments (#2977) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: clean up some warnings and malformed comments * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .kokoro/nightly/integration.cfg | 4 +- .../connection/AbstractStatementParser.java | 51 ++++++++++--------- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg index 9640e74d453..5a95c68284c 100644 --- a/.kokoro/nightly/integration.cfg +++ b/.kokoro/nightly/integration.cfg @@ -13,12 +13,12 @@ env_vars: { # TODO: remove this after we've migrated all tests and scripts env_vars: { key: "GCLOUD_PROJECT" - value: "cloud-java-ci-sample" + value: "java-docs-samples-testing" } env_vars: { key: "GOOGLE_CLOUD_PROJECT" - value: "cloud-java-ci-sample" + value: "java-docs-samples-testing" } env_vars: { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java index 9793a50c636..d0c06fa1d9d 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java @@ -22,7 +22,9 @@ import com.google.cloud.spanner.SpannerException; import com.google.cloud.spanner.SpannerExceptionFactory; import com.google.cloud.spanner.Statement; +import com.google.cloud.spanner.connection.AbstractBaseUnitOfWork.InterceptorsUsage; import com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType; +import com.google.cloud.spanner.connection.UnitOfWork.CallType; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.common.cache.Cache; @@ -32,6 +34,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.spanner.v1.ExecuteSqlRequest.QueryOptions; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -71,12 +74,7 @@ static void resetParsers() { } } - /** - * Get an instance of {@link AbstractStatementParser} for the specified dialect. - * - * @param dialect - * @return - */ + /** Get an instance of {@link AbstractStatementParser} for the specified dialect. */ public static AbstractStatementParser getInstance(Dialect dialect) { synchronized (lock) { if (!INSTANCES.containsKey(dialect)) { @@ -86,19 +84,19 @@ public static AbstractStatementParser getInstance(Dialect dialect) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.INTERNAL, "There is no known statement parser for dialect " + dialect); } - INSTANCES.put(dialect, clazz.newInstance()); - } catch (InstantiationException | IllegalAccessException e) { + INSTANCES.put(dialect, clazz.getDeclaredConstructor().newInstance()); + } catch (Exception exception) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.INTERNAL, "Could not instantiate statement parser for dialect " + dialect.name(), - e); + exception); } } return INSTANCES.get(dialect); } } - /** + /* * The following fixed pre-parsed statements are used internally by the Connection API. These do * not need to be parsed using a specific dialect, as they are equal for all dialects, and * pre-parsing them avoids the need to repeatedly parse statements that are used internally. @@ -108,14 +106,16 @@ public static AbstractStatementParser getInstance(Dialect dialect) { static final ParsedStatement BEGIN_STATEMENT; /** - * Create a COMMIT statement to use with the {@link #commit()} method to allow it to be cancelled, - * time out or retried. + * Create a COMMIT statement to use with the {@link Connection#commit()} method to allow it to be + * cancelled, time out or retried. * - *

{@link ReadWriteTransaction} uses the generic methods {@link #executeAsync(ParsedStatement, - * Callable)} and {@link #runWithRetry(Callable)} to allow statements to be cancelled, to timeout - * and to be retried. These methods require a {@link ParsedStatement} as input. When the {@link - * #commit()} method is called directly, we do not have a {@link ParsedStatement}, and the method - * uses this statement instead in order to use the same logic as the other statements. + *

{@link ReadWriteTransaction} uses the generic methods {@link + * ReadWriteTransaction#executeStatementAsync(CallType, ParsedStatement, Callable, + * InterceptorsUsage, Collection)} and {@link ReadWriteTransaction#runWithRetry(Callable)} to + * allow statements to be cancelled, to timeout and to be retried. These methods require a {@link + * ParsedStatement} as input. When the {@link Connection#commit()} method is called directly, we + * do not have a {@link ParsedStatement}, and the method uses this statement instead in order to + * use the same logic as the other statements. */ static final ParsedStatement COMMIT_STATEMENT; @@ -123,15 +123,16 @@ public static AbstractStatementParser getInstance(Dialect dialect) { static final ParsedStatement ROLLBACK_STATEMENT; /** - * Create a RUN BATCH statement to use with the {@link #executeBatchUpdate(Iterable)} method to - * allow it to be cancelled, time out or retried. + * Create a RUN BATCH statement to use with the {@link Connection#executeBatchUpdate(Iterable)} + * method to allow it to be cancelled, time out or retried. * - *

{@link ReadWriteTransaction} uses the generic methods {@link #executeAsync(ParsedStatement, - * Callable)} and {@link #runWithRetry(Callable)} to allow statements to be cancelled, to timeout - * and to be retried. These methods require a {@link ParsedStatement} as input. When the {@link - * #executeBatchUpdate(Iterable)} method is called, we do not have one {@link ParsedStatement}, - * and the method uses this statement instead in order to use the same logic as the other - * statements. + *

{@link ReadWriteTransaction} uses the generic methods {@link + * ReadWriteTransaction#executeStatementAsync(CallType, ParsedStatement, Callable, Collection)} + * and {@link ReadWriteTransaction#runWithRetry(Callable)} to allow statements to be cancelled, to + * timeout and to be retried. These methods require a {@link ParsedStatement} as input. When the + * {@link Connection#executeBatchUpdate(Iterable)} method is called, we do not have one {@link + * ParsedStatement}, and the method uses this statement instead in order to use the same logic as + * the other statements. */ static final ParsedStatement RUN_BATCH_STATEMENT; From 248744bb1073511d68f8168f600a86bee77e4ee5 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Mon, 1 Apr 2024 13:17:39 +0200 Subject: [PATCH 40/47] chore(deps): update dependency com.google.cloud:google-cloud-spanner to v6.63.0 (#2992) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update dependency com.google.cloud:google-cloud-spanner to v6.63.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- README.md | 8 ++++---- samples/install-without-bom/pom.xml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 723b796a9e6..38c64fa0d73 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ If you are using Maven without the BOM, add this to your dependencies: com.google.cloud google-cloud-spanner - 6.62.0 + 6.63.0 ``` @@ -57,13 +57,13 @@ implementation 'com.google.cloud:google-cloud-spanner' If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-spanner:6.62.0' +implementation 'com.google.cloud:google-cloud-spanner:6.63.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.62.0" +libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.63.0" ``` @@ -650,7 +650,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-spanner/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-spanner.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.62.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.63.0 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index b3647430cac..07f171f0605 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -33,7 +33,7 @@ com.google.cloud google-cloud-spanner - 6.62.0 + 6.63.0 From 629fb3241568a4c28819801675eca2797fa942c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Tue, 2 Apr 2024 11:00:12 +0200 Subject: [PATCH 41/47] feat: add endpoint connection URL property (#2969) Adds an 'endpoint' connection URL property for the Connection API. This property can be used instead of adding the endpoint to the host group part of the Connection URL, which again removes the need to actually change the connection URL when connecting to for example the emulator from the JDBC driver. The latter can instead just add the endpoint to the Properties set that is given to the JDBC driver. --- .../spanner/connection/ConnectionOptions.java | 37 +++++++++--- .../connection/ConnectionOptionsTest.java | 57 +++++++++++++++++++ 2 files changed, 87 insertions(+), 7 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java index 8bca0b2834c..eab86b3d140 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java @@ -175,6 +175,7 @@ public String[] getValidValues() { private static final String DEFAULT_MIN_SESSIONS = null; private static final String DEFAULT_MAX_SESSIONS = null; private static final String DEFAULT_NUM_CHANNELS = null; + static final String DEFAULT_ENDPOINT = null; private static final String DEFAULT_CHANNEL_PROVIDER = null; private static final String DEFAULT_DATABASE_ROLE = null; private static final String DEFAULT_USER_AGENT = null; @@ -234,6 +235,8 @@ public String[] getValidValues() { public static final String MAX_SESSIONS_PROPERTY_NAME = "maxSessions"; /** Name of the 'numChannels' connection property. */ public static final String NUM_CHANNELS_PROPERTY_NAME = "numChannels"; + /** Name of the 'endpoint' connection property. */ + public static final String ENDPOINT_PROPERTY_NAME = "endpoint"; /** Name of the 'channelProvider' connection property. */ public static final String CHANNEL_PROVIDER_PROPERTY_NAME = "channelProvider"; @@ -332,6 +335,12 @@ private static String generateGuardedConnectionPropertyError( ConnectionProperty.createStringProperty( NUM_CHANNELS_PROPERTY_NAME, "The number of gRPC channels to use to communicate with Cloud Spanner. The default is 4."), + ConnectionProperty.createStringProperty( + ENDPOINT_PROPERTY_NAME, + "The endpoint that the JDBC driver should connect to. " + + "The default is the default Spanner production endpoint when autoConfigEmulator=false, " + + "and the default Spanner emulator endpoint (localhost:9010) when autoConfigEmulator=true. " + + "This property takes precedence over any host name at the start of the connection URL."), ConnectionProperty.createStringProperty( CHANNEL_PROVIDER_PROPERTY_NAME, "The name of the channel provider class. The name must reference an implementation of ExternalChannelProvider. If this property is not set, the connection will use the default grpc channel provider."), @@ -738,7 +747,9 @@ private ConnectionOptions(Builder builder) { this.autoConfigEmulator = parseAutoConfigEmulator(this.uri); this.dialect = parseDialect(this.uri); this.usePlainText = this.autoConfigEmulator || parseUsePlainText(this.uri); - this.host = determineHost(matcher, autoConfigEmulator, usePlainText, System.getenv()); + this.host = + determineHost( + matcher, parseEndpoint(this.uri), autoConfigEmulator, usePlainText, System.getenv()); this.rpcPriority = parseRPCPriority(this.uri); this.delayTransactionStartUntilFirstWrite = parseDelayTransactionStartUntilFirstWrite(this.uri); this.trackSessionLeaks = parseTrackSessionLeaks(this.uri); @@ -829,10 +840,12 @@ private ConnectionOptions(Builder builder) { @VisibleForTesting static String determineHost( Matcher matcher, + String endpoint, boolean autoConfigEmulator, boolean usePlainText, Map environment) { - if (matcher.group(Builder.HOST_GROUP) == null) { + String host; + if (Objects.equals(endpoint, DEFAULT_ENDPOINT) && matcher.group(Builder.HOST_GROUP) == null) { if (autoConfigEmulator) { if (Strings.isNullOrEmpty(environment.get(SPANNER_EMULATOR_HOST_ENV_VAR))) { return DEFAULT_EMULATOR_HOST; @@ -842,13 +855,18 @@ static String determineHost( } else { return DEFAULT_HOST; } + } else if (!Objects.equals(endpoint, DEFAULT_ENDPOINT)) { + // Add '//' at the start of the endpoint to conform to the standard URL specification. + host = "//" + endpoint; } else { - if (usePlainText) { - return PLAIN_TEXT_PROTOCOL + matcher.group(Builder.HOST_GROUP); - } else { - return HOST_PROTOCOL + matcher.group(Builder.HOST_GROUP); - } + // The leading '//' is already included in the regex for the connection URL, so we don't need + // to add the leading '//' to the host name here. + host = matcher.group(Builder.HOST_GROUP); } + if (usePlainText) { + return PLAIN_TEXT_PROTOCOL + host; + } + return HOST_PROTOCOL + host; } private static Integer parseIntegerProperty(String propertyName, String value) { @@ -1013,6 +1031,11 @@ static String parseNumChannels(String uri) { return value != null ? value : DEFAULT_NUM_CHANNELS; } + private static String parseEndpoint(String uri) { + String value = parseUriProperty(uri, ENDPOINT_PROPERTY_NAME); + return value != null ? value : DEFAULT_ENDPOINT; + } + @VisibleForTesting static String parseChannelProvider(String uri) { String value = parseUriProperty(uri, CHANNEL_PROVIDER_PROPERTY_NAME); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsTest.java index bdca80a214d..16ecc87bd6e 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsTest.java @@ -17,6 +17,7 @@ package com.google.cloud.spanner.connection; import static com.google.cloud.spanner.connection.ConnectionOptions.Builder.SPANNER_URI_PATTERN; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_ENDPOINT; import static com.google.cloud.spanner.connection.ConnectionOptions.determineHost; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; @@ -172,6 +173,7 @@ public void testDetermineHost() { DEFAULT_HOST, determineHost( matcherWithoutHost, + DEFAULT_ENDPOINT, /* autoConfigEmulator= */ false, /* usePlainText= */ false, ImmutableMap.of())); @@ -179,6 +181,7 @@ public void testDetermineHost() { DEFAULT_HOST, determineHost( matcherWithoutHost, + DEFAULT_ENDPOINT, /* autoConfigEmulator= */ false, /* usePlainText= */ false, ImmutableMap.of("FOO", "bar"))); @@ -186,6 +189,7 @@ public void testDetermineHost() { "http://localhost:9010", determineHost( matcherWithoutHost, + DEFAULT_ENDPOINT, /* autoConfigEmulator= */ true, /* usePlainText= */ false, ImmutableMap.of())); @@ -193,6 +197,7 @@ public void testDetermineHost() { "http://localhost:9011", determineHost( matcherWithoutHost, + DEFAULT_ENDPOINT, /* autoConfigEmulator= */ true, /* usePlainText= */ false, ImmutableMap.of("SPANNER_EMULATOR_HOST", "localhost:9011"))); @@ -200,6 +205,7 @@ public void testDetermineHost() { "http://localhost:9010", determineHost( matcherWithoutHost, + DEFAULT_ENDPOINT, /* autoConfigEmulator= */ true, /* usePlainText= */ true, ImmutableMap.of())); @@ -207,6 +213,7 @@ public void testDetermineHost() { "http://localhost:9011", determineHost( matcherWithoutHost, + DEFAULT_ENDPOINT, /* autoConfigEmulator= */ true, /* usePlainText= */ true, ImmutableMap.of("SPANNER_EMULATOR_HOST", "localhost:9011"))); @@ -216,6 +223,7 @@ public void testDetermineHost() { "https://custom.host.domain:1234", determineHost( matcherWithHost, + DEFAULT_ENDPOINT, /* autoConfigEmulator= */ false, /* usePlainText= */ false, ImmutableMap.of())); @@ -223,6 +231,7 @@ public void testDetermineHost() { "http://custom.host.domain:1234", determineHost( matcherWithHost, + DEFAULT_ENDPOINT, /* autoConfigEmulator= */ false, /* usePlainText= */ true, ImmutableMap.of())); @@ -230,6 +239,7 @@ public void testDetermineHost() { "http://custom.host.domain:1234", determineHost( matcherWithHost, + DEFAULT_ENDPOINT, /* autoConfigEmulator= */ false, /* usePlainText= */ true, ImmutableMap.of())); @@ -237,6 +247,7 @@ public void testDetermineHost() { "https://custom.host.domain:1234", determineHost( matcherWithHost, + DEFAULT_ENDPOINT, /* autoConfigEmulator= */ true, /* usePlainText= */ false, ImmutableMap.of())); @@ -244,6 +255,7 @@ public void testDetermineHost() { "http://custom.host.domain:1234", determineHost( matcherWithHost, + DEFAULT_ENDPOINT, /* autoConfigEmulator= */ false, /* usePlainText= */ true, ImmutableMap.of("SPANNER_EMULATOR_HOST", "localhost:9011"))); @@ -251,9 +263,40 @@ public void testDetermineHost() { "https://custom.host.domain:1234", determineHost( matcherWithHost, + DEFAULT_ENDPOINT, /* autoConfigEmulator= */ true, /* usePlainText= */ false, ImmutableMap.of("SPANNER_EMULATOR_HOST", "localhost:9011"))); + + // The 'endpoint' connection URL property can also be used to connect to the emulator. + // Using this property is sometimes easier than adding the URL to the host part of the + // connection string, for example because it can be added to the Properties object that + // is used by JDBC. + assertEquals( + "http://localhost:9010", + determineHost( + matcherWithoutHost, + "localhost:9010", + /* autoConfigEmulator= */ false, + /* usePlainText= */ true, + ImmutableMap.of())); + // A value for the 'endpoint' connection property overrides any value in the host group. + assertEquals( + "https://my.endpoint:1234", + determineHost( + matcherWithHost, + "my.endpoint:1234", + /* autoConfigEmulator= */ false, + /* usePlainText= */ false, + ImmutableMap.of("SPANNER_EMULATOR_HOST", "localhost:9011"))); + assertEquals( + "http://my.endpoint.local:1234", + determineHost( + matcherWithHost, + "my.endpoint.local:1234", + /* autoConfigEmulator= */ false, + /* usePlainText= */ true, + ImmutableMap.of())); } @Test @@ -291,6 +334,20 @@ public void testBuildWithAutoConfigEmulatorAndHost() { assertTrue(options.isUsePlainText()); } + @Test + public void testBuildWithAutoConfigEmulatorAndEndpoint() { + ConnectionOptions.Builder builder = ConnectionOptions.newBuilder(); + builder.setUri( + "cloudspanner:/projects/test-project-123/instances/test-instance-123/databases/test-database-123?autoConfigEmulator=true;endpoint=central-emulator.local:8080"); + ConnectionOptions options = builder.build(); + assertEquals("http://central-emulator.local:8080", options.getHost()); + assertEquals("test-project-123", options.getProjectId()); + assertEquals("test-instance-123", options.getInstanceId()); + assertEquals("test-database-123", options.getDatabaseName()); + assertEquals(NoCredentials.getInstance(), options.getCredentials()); + assertTrue(options.isUsePlainText()); + } + @Test public void testBuildWithDefaultProjectPlaceholder() { ConnectionOptions.Builder builder = ConnectionOptions.newBuilder(); From b72581c931f9378157798f43167763295a6e520d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Tue, 2 Apr 2024 11:00:46 +0200 Subject: [PATCH 42/47] feat: support max_commit_delay in Connection API (#2954) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: support max_commit_delay in Connection API Adds support for max_commit_delay to the Connection API: 1. Adds a setMaxCommitDelay(Duration) method to Connection 2. Adds a maxCommitDelay connection URL property 3. Adds a SET MAX_COMMIT_DELAY= SQL statement * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../clirr-ignored-differences.xml | 12 + .../cloud/spanner/connection/Connection.java | 11 + .../spanner/connection/ConnectionImpl.java | 18 ++ .../spanner/connection/ConnectionOptions.java | 32 +++ .../ConnectionStatementExecutor.java | 4 + .../ConnectionStatementExecutorImpl.java | 22 ++ .../connection/ReadWriteTransaction.java | 13 + .../connection/SingleUseTransaction.java | 16 ++ .../spanner/connection/StatementResult.java | 2 + .../connection/ClientSideStatements.json | 24 ++ .../connection/PG_ClientSideStatements.json | 24 ++ .../connection/ConnectionOptionsTest.java | 21 ++ .../connection/MaxCommitDelayTest.java | 159 +++++++++++++ .../ConnectionImplGeneratedSqlScriptTest.sql | 224 +++++++++--------- .../ConnectionImplGeneratedSqlScriptTest.sql | 224 +++++++++--------- 15 files changed, 582 insertions(+), 224 deletions(-) create mode 100644 google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/MaxCommitDelayTest.java diff --git a/google-cloud-spanner/clirr-ignored-differences.xml b/google-cloud-spanner/clirr-ignored-differences.xml index e97a5cc7527..1342e771bfa 100644 --- a/google-cloud-spanner/clirr-ignored-differences.xml +++ b/google-cloud-spanner/clirr-ignored-differences.xml @@ -643,4 +643,16 @@ com/google/cloud/spanner/connection/Connection void setDirectedRead(com.google.spanner.v1.DirectedReadOptions) + + + + 7012 + com/google/cloud/spanner/connection/Connection + java.time.Duration getMaxCommitDelay() + + + 7012 + com/google/cloud/spanner/connection/Connection + void setMaxCommitDelay(java.time.Duration) + diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/Connection.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/Connection.java index ffcef91d9c9..d43e14a177b 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/Connection.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/Connection.java @@ -41,6 +41,7 @@ import com.google.spanner.v1.DirectedReadOptions; import com.google.spanner.v1.ExecuteBatchDmlRequest; import com.google.spanner.v1.ResultSetStats; +import java.time.Duration; import java.util.Iterator; import java.util.Set; import java.util.concurrent.ExecutionException; @@ -556,6 +557,16 @@ default String getOptimizerStatisticsPackage() { /** @return true if this connection requests commit statistics from Cloud Spanner */ boolean isReturnCommitStats(); + /** Sets the max_commit_delay that will be applied to commit requests from this connection. */ + default void setMaxCommitDelay(Duration maxCommitDelay) { + throw new UnsupportedOperationException("Unimplemented"); + } + + /** Returns the max_commit_delay that will be applied to commit requests from this connection. */ + default Duration getMaxCommitDelay() { + throw new UnsupportedOperationException("Unimplemented"); + } + /** * Sets the priority to use for RPCs executed by this connection.. * diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionImpl.java index 8ff367b2486..96c509a16aa 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionImpl.java @@ -56,6 +56,7 @@ import com.google.spanner.v1.DirectedReadOptions; import com.google.spanner.v1.ExecuteSqlRequest.QueryOptions; import com.google.spanner.v1.ResultSetStats; +import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -245,6 +246,8 @@ static UnitOfWorkType of(TransactionMode transactionMode) { private String transactionTag; private String statementTag; + private Duration maxCommitDelay; + /** Create a connection and register it in the SpannerPool. */ ConnectionImpl(ConnectionOptions options) { Preconditions.checkNotNull(options); @@ -273,6 +276,7 @@ static UnitOfWorkType of(TransactionMode transactionMode) { this.autoPartitionMode = options.isAutoPartitionMode(); this.maxPartitions = options.getMaxPartitions(); this.maxPartitionedParallelism = options.getMaxPartitionedParallelism(); + this.maxCommitDelay = options.getMaxCommitDelay(); this.ddlClient = createDdlClient(); setDefaultTransactionOptions(); } @@ -791,6 +795,18 @@ public boolean isReturnCommitStats() { return this.returnCommitStats; } + @Override + public void setMaxCommitDelay(Duration maxCommitDelay) { + ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); + this.maxCommitDelay = maxCommitDelay; + } + + @Override + public Duration getMaxCommitDelay() { + ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); + return this.maxCommitDelay; + } + @Override public void setDelayTransactionStartUntilFirstWrite( boolean delayTransactionStartUntilFirstWrite) { @@ -1614,6 +1630,7 @@ UnitOfWork createNewUnitOfWork(boolean isInternalMetadataQuery) { .setReadOnlyStaleness(readOnlyStaleness) .setAutocommitDmlMode(autocommitDmlMode) .setReturnCommitStats(returnCommitStats) + .setMaxCommitDelay(maxCommitDelay) .setStatementTimeout(statementTimeout) .withStatementExecutor(statementExecutor) .build(); @@ -1636,6 +1653,7 @@ UnitOfWork createNewUnitOfWork(boolean isInternalMetadataQuery) { .setRetryAbortsInternally(retryAbortsInternally) .setSavepointSupport(savepointSupport) .setReturnCommitStats(returnCommitStats) + .setMaxCommitDelay(maxCommitDelay) .setTransactionRetryListeners(transactionRetryListeners) .setStatementTimeout(statementTimeout) .withStatementExecutor(statementExecutor) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java index eab86b3d140..de58117d4bc 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java @@ -44,6 +44,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.net.URL; +import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -357,6 +358,9 @@ private static String generateGuardedConnectionPropertyError( ConnectionProperty.createStringProperty( OPTIMIZER_STATISTICS_PACKAGE_PROPERTY_NAME, ""), ConnectionProperty.createBooleanProperty("returnCommitStats", "", false), + ConnectionProperty.createStringProperty( + "maxCommitDelay", + "The maximum commit delay in milliseconds that should be applied to commit requests from this connection."), ConnectionProperty.createBooleanProperty( "autoConfigEmulator", "Automatically configure the connection to try to connect to the Cloud Spanner emulator (true/false). " @@ -689,6 +693,7 @@ public static Builder newBuilder() { private final String userAgent; private final QueryOptions queryOptions; private final boolean returnCommitStats; + private final Long maxCommitDelay; private final boolean autoConfigEmulator; private final Dialect dialect; private final RpcPriority rpcPriority; @@ -744,6 +749,7 @@ private ConnectionOptions(Builder builder) { queryOptionsBuilder.setOptimizerStatisticsPackage(parseOptimizerStatisticsPackage(this.uri)); this.queryOptions = queryOptionsBuilder.build(); this.returnCommitStats = parseReturnCommitStats(this.uri); + this.maxCommitDelay = parseMaxCommitDelay(this.uri); this.autoConfigEmulator = parseAutoConfigEmulator(this.uri); this.dialect = parseDialect(this.uri); this.usePlainText = this.autoConfigEmulator || parseUsePlainText(this.uri); @@ -1074,6 +1080,27 @@ static boolean parseReturnCommitStats(String uri) { return Boolean.parseBoolean(value); } + @VisibleForTesting + static Long parseMaxCommitDelay(String uri) { + String value = parseUriProperty(uri, "maxCommitDelay"); + try { + Long millis = value == null ? null : Long.valueOf(value); + if (millis != null && millis < 0L) { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.INVALID_ARGUMENT, "maxCommitDelay must be >=0"); + } + return millis; + } catch (NumberFormatException numberFormatException) { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.INVALID_ARGUMENT, + "Invalid value for maxCommitDelay: " + + value + + "\n" + + "The value must be a positive integer indicating the number of " + + "milliseconds to use as the max delay."); + } + } + static boolean parseAutoConfigEmulator(String uri) { String value = parseUriProperty(uri, "autoConfigEmulator"); return Boolean.parseBoolean(value); @@ -1405,6 +1432,11 @@ public boolean isReturnCommitStats() { return returnCommitStats; } + /** The max_commit_delay that should be applied to commit operations on this connection. */ + public Duration getMaxCommitDelay() { + return maxCommitDelay == null ? null : Duration.ofMillis(maxCommitDelay); + } + /** * Whether connections created by this {@link ConnectionOptions} will automatically try to connect * to the emulator using the default host/port of the emulator, and automatically create the diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutor.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutor.java index 3fbc3e7a8d4..cc4c53275b3 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutor.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutor.java @@ -82,6 +82,10 @@ interface ConnectionStatementExecutor { StatementResult statementShowReturnCommitStats(); + StatementResult statementSetMaxCommitDelay(Duration maxCommitDelay); + + StatementResult statementShowMaxCommitDelay(); + StatementResult statementSetDelayTransactionStartUntilFirstWrite( Boolean delayTransactionStartUntilFirstWrite); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutorImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutorImpl.java index 0e8bdada223..ec0ca4f4ac3 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutorImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionStatementExecutorImpl.java @@ -29,6 +29,7 @@ import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SET_DEFAULT_TRANSACTION_ISOLATION; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SET_DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SET_DIRECTED_READ; +import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SET_MAX_COMMIT_DELAY; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SET_MAX_PARTITIONED_PARALLELISM; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SET_MAX_PARTITIONS; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SET_OPTIMIZER_STATISTICS_PACKAGE; @@ -51,6 +52,7 @@ import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SHOW_DATA_BOOST_ENABLED; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SHOW_DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SHOW_DIRECTED_READ; +import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SHOW_MAX_COMMIT_DELAY; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SHOW_MAX_PARTITIONED_PARALLELISM; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SHOW_MAX_PARTITIONS; import static com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType.SHOW_OPTIMIZER_STATISTICS_PACKAGE; @@ -343,6 +345,26 @@ public StatementResult statementShowReturnCommitStats() { SHOW_RETURN_COMMIT_STATS); } + @Override + public StatementResult statementSetMaxCommitDelay(Duration duration) { + getConnection() + .setMaxCommitDelay( + duration == null || duration.equals(Duration.getDefaultInstance()) + ? null + : java.time.Duration.ofSeconds(duration.getSeconds(), duration.getNanos())); + return noResult(SET_MAX_COMMIT_DELAY); + } + + @Override + public StatementResult statementShowMaxCommitDelay() { + return resultSet( + "MAX_COMMIT_DELAY", + getConnection().getMaxCommitDelay() == null + ? null + : getConnection().getMaxCommitDelay().toMillis() + "ms", + SHOW_MAX_COMMIT_DELAY); + } + @Override public StatementResult statementSetDelayTransactionStartUntilFirstWrite( Boolean delayTransactionStartUntilFirstWrite) { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReadWriteTransaction.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReadWriteTransaction.java index 6c4290c3b18..05a8e899988 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReadWriteTransaction.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReadWriteTransaction.java @@ -57,6 +57,7 @@ import com.google.common.collect.Iterables; import com.google.common.util.concurrent.MoreExecutors; import com.google.spanner.v1.SpannerGrpc; +import java.time.Duration; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -111,6 +112,7 @@ static class Builder extends AbstractMultiUseTransaction.Builder transactionRetryListeners; @@ -137,6 +139,11 @@ Builder setReturnCommitStats(boolean returnCommitStats) { return this; } + Builder setMaxCommitDelay(Duration maxCommitDelay) { + this.maxCommitDelay = maxCommitDelay; + return this; + } + Builder setSavepointSupport(SavepointSupport savepointSupport) { this.savepointSupport = savepointSupport; return this; @@ -180,6 +187,9 @@ private TransactionOption[] extractOptions(Builder builder) { if (builder.returnCommitStats) { numOptions++; } + if (builder.maxCommitDelay != null) { + numOptions++; + } if (this.transactionTag != null) { numOptions++; } @@ -191,6 +201,9 @@ private TransactionOption[] extractOptions(Builder builder) { if (builder.returnCommitStats) { options[index++] = Options.commitStats(); } + if (builder.maxCommitDelay != null) { + options[index++] = Options.maxCommitDelay(builder.maxCommitDelay); + } if (this.transactionTag != null) { options[index++] = Options.tag(this.transactionTag); } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SingleUseTransaction.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SingleUseTransaction.java index 56ddc16322a..164c3ae7ada 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SingleUseTransaction.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SingleUseTransaction.java @@ -46,12 +46,14 @@ import com.google.cloud.spanner.Type; import com.google.cloud.spanner.connection.AbstractStatementParser.ParsedStatement; import com.google.cloud.spanner.connection.AbstractStatementParser.StatementType; +import com.google.cloud.spanner.connection.ReadWriteTransaction.Builder; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.common.util.concurrent.MoreExecutors; import com.google.spanner.admin.database.v1.DatabaseAdminGrpc; import com.google.spanner.v1.SpannerGrpc; +import java.time.Duration; import java.util.concurrent.Callable; /** @@ -78,6 +80,7 @@ class SingleUseTransaction extends AbstractBaseUnitOfWork { private final TimestampBound readOnlyStaleness; private final AutocommitDmlMode autocommitDmlMode; private final boolean returnCommitStats; + private final Duration maxCommitDelay; private final boolean internalMetdataQuery; private volatile SettableApiFuture readTimestamp = null; private volatile TransactionRunner writeTransaction; @@ -92,6 +95,7 @@ static class Builder extends AbstractBaseUnitOfWork.Builder'|NULL", + "executorName": "ClientSideStatementSetExecutor", + "resultType": "NO_RESULT", + "statementType": "SET_MAX_COMMIT_DELAY", + "regex": "(?is)\\A\\s*set\\s+spanner\\.max_commit_delay(?:\\s*=\\s*|\\s+to\\s+)(.*)\\z", + "method": "statementSetMaxCommitDelay", + "exampleStatements": ["set spanner.max_commit_delay=null", "set spanner.max_commit_delay='1s'", "set spanner.max_commit_delay='100ms'", "set spanner.max_commit_delay to '10000us'", "set spanner.max_commit_delay TO '9223372036854775807ns'"], + "setStatement": { + "propertyName": "SPANNER.MAX_COMMIT_DELAY", + "separator": "(?:=|\\s+TO\\s+)", + "allowedValues": "('(\\d{1,19})(s|ms|us|ns)'|NULL)", + "converterName": "ClientSideStatementValueConverters$DurationConverter" + } + }, { "name": "SET SPANNER.STATEMENT_TAG =|TO ''", "executorName": "ClientSideStatementSetExecutor", diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsTest.java index 16ecc87bd6e..53b9f3d826f 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsTest.java @@ -22,6 +22,7 @@ import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; @@ -41,6 +42,7 @@ import com.google.common.io.Files; import java.io.File; import java.nio.charset.StandardCharsets; +import java.time.Duration; import java.util.Arrays; import java.util.Collections; import java.util.Objects; @@ -1144,4 +1146,23 @@ public void testUseVirtualGrpcTransportThreads() { .build() .isUseVirtualThreads()); } + + @Test + public void testMaxCommitDelay() { + assertNull( + ConnectionOptions.newBuilder() + .setUri( + "cloudspanner:/projects/test-project-123/instances/test-instance/databases/test-database") + .setCredentials(NoCredentials.getInstance()) + .build() + .getMaxCommitDelay()); + assertEquals( + Duration.ofMillis(10L), + ConnectionOptions.newBuilder() + .setUri( + "cloudspanner:/projects/test-project-123/instances/test-instance/databases/test-database?maxCommitDelay=10") + .setCredentials(NoCredentials.getInstance()) + .build() + .getMaxCommitDelay()); + } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/MaxCommitDelayTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/MaxCommitDelayTest.java new file mode 100644 index 00000000000..1e22986cce2 --- /dev/null +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/MaxCommitDelayTest.java @@ -0,0 +1,159 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner.connection; + +import static junit.framework.TestCase.assertEquals; + +import com.google.cloud.spanner.Dialect; +import com.google.cloud.spanner.MockSpannerServiceImpl; +import com.google.cloud.spanner.Mutation; +import com.google.cloud.spanner.Statement; +import com.google.common.collect.ImmutableList; +import com.google.protobuf.Duration; +import com.google.spanner.v1.CommitRequest; +import java.time.temporal.ChronoUnit; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.TimeUnit; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class MaxCommitDelayTest extends AbstractMockServerTest { + + @Parameters(name = "dialect = {0}") + public static Collection data() { + ImmutableList.Builder builder = ImmutableList.builder(); + for (Dialect dialect : Dialect.values()) { + builder.add(new Object[] {dialect}); + } + return builder.build(); + } + + @Parameter public Dialect dialect; + + private Dialect currentDialect; + + @Before + public void setupDialect() { + if (currentDialect != dialect) { + // Reset the dialect result. + SpannerPool.closeSpannerPool(); + mockSpanner.putStatementResult( + MockSpannerServiceImpl.StatementResult.detectDialectResult(dialect)); + currentDialect = dialect; + } + } + + private Mutation createMutation() { + return Mutation.newInsertBuilder("foo").set("id").to(1L).build(); + } + + private String getVariablePrefix() { + return dialect == Dialect.POSTGRESQL ? "spanner." : ""; + } + + @After + public void clearRequests() { + mockSpanner.clearRequests(); + } + + @Test + public void testNoMaxCommitDelayByDefault() { + try (Connection connection = createConnection()) { + for (boolean autocommit : new boolean[] {true, false}) { + connection.setAutocommit(autocommit); + executeCommit(connection); + assertMaxCommitDelay(Duration.getDefaultInstance()); + mockSpanner.clearRequests(); + } + } + } + + @Test + public void testMaxCommitDelayInConnectionString() { + try (Connection connection = createConnection(";maxCommitDelay=1000")) { + for (boolean autocommit : new boolean[] {true, false}) { + connection.setAutocommit(autocommit); + executeCommit(connection); + assertMaxCommitDelay(Duration.newBuilder().setSeconds(1).build()); + mockSpanner.clearRequests(); + } + } + } + + @Test + public void testSetMaxCommitDelay() { + try (Connection connection = createConnection()) { + for (boolean autocommit : new boolean[] {true, false}) { + for (boolean useSql : new boolean[] {true, false}) { + connection.setAutocommit(autocommit); + + if (useSql) { + connection.execute( + Statement.of(String.format("set %smax_commit_delay='40ms'", getVariablePrefix()))); + } else { + connection.setMaxCommitDelay(java.time.Duration.of(40_000, ChronoUnit.MICROS)); + } + + // Execute two transactions to verify that the new setting is applied to all transactions, + // and not only the first one that is executed after setting the max_commit_delay value. + Repeat.twice( + () -> { + executeCommit(connection); + assertMaxCommitDelay( + Duration.newBuilder() + .setNanos((int) TimeUnit.MILLISECONDS.toNanos(40)) + .build()); + mockSpanner.clearRequests(); + }); + + if (useSql) { + connection.execute( + Statement.of(String.format("set %smax_commit_delay=null", getVariablePrefix()))); + } else { + connection.setMaxCommitDelay(null); + } + executeCommit(connection); + assertMaxCommitDelay(Duration.getDefaultInstance()); + mockSpanner.clearRequests(); + } + } + } + } + + void executeCommit(Connection connection) { + if (connection.isAutocommit()) { + connection.write(createMutation()); + } else { + connection.bufferedWrite(createMutation()); + connection.commit(); + } + } + + private void assertMaxCommitDelay(Duration expected) { + List requests = mockSpanner.getRequestsOfType(CommitRequest.class); + assertEquals(1, requests.size()); + CommitRequest request = requests.get(0); + assertEquals(expected, request.getMaxCommitDelay()); + } +} diff --git a/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/ConnectionImplGeneratedSqlScriptTest.sql b/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/ConnectionImplGeneratedSqlScriptTest.sql index afd36776317..bde12f6662e 100644 --- a/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/ConnectionImplGeneratedSqlScriptTest.sql +++ b/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/ConnectionImplGeneratedSqlScriptTest.sql @@ -160,15 +160,15 @@ NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:45.964000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:45.964000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:15.740000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:15.740000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:45.964000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:15.740000000Z'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -510,15 +510,15 @@ NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.090000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.090000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:16.217000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:16.217000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.090000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:16.217000000Z'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -950,8 +950,8 @@ BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; ROLLBACK; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.188000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.188000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:16.608000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:16.608000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; @@ -961,7 +961,7 @@ BEGIN TRANSACTION; SELECT 1 AS TEST; ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.188000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:16.608000000Z'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -1462,8 +1462,8 @@ BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.289000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.289000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:17.090000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:17.090000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; @@ -1473,7 +1473,7 @@ BEGIN TRANSACTION; SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.289000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:17.090000000Z'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -1876,15 +1876,15 @@ NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.382000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.382000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:17.518000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:17.518000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.382000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:17.518000000Z'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -2243,14 +2243,14 @@ SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.455000000Z'; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:17.918000000Z'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.455000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:17.918000000Z'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -2600,13 +2600,13 @@ SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.532000000Z'; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:18.303000000Z'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.532000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:18.303000000Z'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -2910,14 +2910,14 @@ SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.605000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.605000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:18.684000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:18.684000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.605000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:18.684000000Z'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -3246,15 +3246,15 @@ NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.688000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.688000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:19.116000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:19.116000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.688000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:19.116000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -3664,8 +3664,8 @@ SET AUTOCOMMIT=FALSE; START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); RUN BATCH; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.755000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.755000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:19.521000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:19.521000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; @@ -3674,7 +3674,7 @@ START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.755000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:19.521000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -4083,14 +4083,14 @@ SET AUTOCOMMIT=FALSE; START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.825000000Z'; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:19.953000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.825000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:19.953000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -4440,13 +4440,13 @@ SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.881000000Z'; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:20.274000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.881000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:20.274000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -4880,8 +4880,8 @@ SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.940000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.940000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:20.662000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:20.662000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; @@ -4891,7 +4891,7 @@ SET TRANSACTION READ ONLY; SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.940000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:20.662000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -5291,15 +5291,15 @@ NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; SET TRANSACTION READ ONLY; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.009000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.009000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:21.051000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:21.051000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.009000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:21.051000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -5645,15 +5645,15 @@ NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.061000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.061000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:21.343000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:21.343000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; SET READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.061000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:21.343000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -6093,8 +6093,8 @@ BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; ROLLBACK; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.119000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.119000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:21.630000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:21.630000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; @@ -6104,7 +6104,7 @@ BEGIN TRANSACTION; SELECT 1 AS TEST; ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.119000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:21.630000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -6613,8 +6613,8 @@ BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.220000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.220000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:22.181000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:22.181000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; @@ -6624,7 +6624,7 @@ BEGIN TRANSACTION; SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.220000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:22.181000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -7029,15 +7029,15 @@ NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.290000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.290000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:22.566000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:22.566000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.290000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:22.566000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -7400,14 +7400,14 @@ SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.348000000Z'; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:22.853000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.348000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:22.853000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -7762,13 +7762,13 @@ SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.416000000Z'; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:23.261000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.416000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:23.261000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -8082,14 +8082,14 @@ SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.475000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.475000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:23.615000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:23.615000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.475000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:23.615000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -8399,13 +8399,13 @@ SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.523000000Z'; +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:23.894000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.523000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:23.894000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; @@ -8760,8 +8760,8 @@ SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET TRANSACTION READ ONLY; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.574000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.574000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:24.167000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:24.167000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; @@ -8769,7 +8769,7 @@ SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.574000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:24.167000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; @@ -9204,8 +9204,8 @@ SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; UPDATE foo SET bar=1; COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.631000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.631000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:24.502000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:24.502000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; @@ -9213,8 +9213,8 @@ SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; UPDATE foo SET bar=1; COMMIT; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.631000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:47.631000000Z' +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:24.502000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:24.502000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; @@ -9600,15 +9600,15 @@ NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.693000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.693000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:24.834000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:24.834000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.693000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:24.834000000Z'; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; @@ -9959,15 +9959,15 @@ NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.748000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.748000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:25.130000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:25.130000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.748000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:47.748000000Z' +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:25.130000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:25.130000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; @@ -10327,15 +10327,15 @@ NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; UPDATE foo SET bar=1; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.806000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.806000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:25.446000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:25.446000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; UPDATE foo SET bar=1; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.806000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:47.806000000Z' +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:25.446000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:25.446000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; @@ -10725,16 +10725,16 @@ SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.863000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.863000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:25.758000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:25.758000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.863000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:47.863000000Z' +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:25.758000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:25.758000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; @@ -11117,15 +11117,15 @@ NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.924000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.924000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:26.062000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:26.062000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.924000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:47.924000000Z' +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:26.062000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:26.062000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; @@ -11455,14 +11455,14 @@ SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.985000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.985000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:26.366000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:26.366000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.985000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:47.985000000Z' +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:26.366000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:26.366000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=FALSE; @@ -11785,15 +11785,15 @@ NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=TRUE; SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:48.034000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:48.034000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:26.618000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:26.618000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=TRUE; SET READ_ONLY_STALENESS='MAX_STALENESS 10s'; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:48.034000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:48.034000000Z' +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:26.618000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:26.618000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; @@ -12200,8 +12200,8 @@ SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SELECT 1 AS TEST; COMMIT; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:48.085000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:48.085000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:26.883000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:26.883000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; @@ -12209,8 +12209,8 @@ SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SELECT 1 AS TEST; COMMIT; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:48.085000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:48.085000000Z' +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:26.883000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:26.883000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; @@ -12593,15 +12593,15 @@ NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:48.146000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:48.146000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:27.234000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:27.234000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:48.146000000Z'; +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:27.234000000Z'; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=TRUE; @@ -12939,15 +12939,15 @@ NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:48.232000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:48.232000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:27.524000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:27.524000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:48.232000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:48.232000000Z' +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:27.524000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:27.524000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; @@ -13294,15 +13294,15 @@ NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:48.288000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:48.288000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:27.818000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:27.818000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:48.288000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:48.288000000Z' +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:27.818000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:27.818000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; @@ -13619,14 +13619,14 @@ SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:48.341000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:48.341000000Z' +SET READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:28.091000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:28.091000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; SET AUTOCOMMIT=TRUE; -SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:48.341000000Z'; -@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:48.341000000Z' +SET READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:28.091000000Z'; +@EXPECT RESULT_SET 'READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:28.091000000Z' SHOW VARIABLE READ_ONLY_STALENESS; NEW_CONNECTION; SET READONLY=TRUE; diff --git a/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/postgresql/ConnectionImplGeneratedSqlScriptTest.sql b/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/postgresql/ConnectionImplGeneratedSqlScriptTest.sql index 1757973f593..c64d2b6ce13 100644 --- a/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/postgresql/ConnectionImplGeneratedSqlScriptTest.sql +++ b/google-cloud-spanner/src/test/resources/com/google/cloud/spanner/connection/postgresql/ConnectionImplGeneratedSqlScriptTest.sql @@ -160,15 +160,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.025000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.025000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:16.008000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:16.008000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.025000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:16.008000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -510,15 +510,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.135000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.135000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:16.391000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:16.391000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.135000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:16.391000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -950,8 +950,8 @@ BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; ROLLBACK; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.241000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.241000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:16.882000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:16.882000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; @@ -961,7 +961,7 @@ BEGIN TRANSACTION; SELECT 1 AS TEST; ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.241000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:16.882000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -1462,8 +1462,8 @@ BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.337000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.337000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:17.326000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:17.326000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; @@ -1473,7 +1473,7 @@ BEGIN TRANSACTION; SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.337000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:17.326000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -1876,15 +1876,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.418000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.418000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:17.672000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:17.672000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.418000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:17.672000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -2243,14 +2243,14 @@ SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.494000000Z'; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:18.117000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.494000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:18.117000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -2600,13 +2600,13 @@ SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.568000000Z'; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:18.509000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.568000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:18.509000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -2910,14 +2910,14 @@ SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.636000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.636000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:18.834000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:18.834000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.636000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:18.834000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=FALSE; @@ -3246,15 +3246,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.718000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.718000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:19.286000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:19.286000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.718000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:19.286000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -3664,8 +3664,8 @@ SET AUTOCOMMIT=FALSE; START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); RUN BATCH; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.789000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.789000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:19.688000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:19.688000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; @@ -3674,7 +3674,7 @@ START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); RUN BATCH; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.789000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:19.688000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -4083,14 +4083,14 @@ SET AUTOCOMMIT=FALSE; START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.854000000Z'; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:20.139000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; START BATCH DDL; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.854000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:20.139000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -4440,13 +4440,13 @@ SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.908000000Z'; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:20.445000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.908000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:20.445000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -4880,8 +4880,8 @@ SET TRANSACTION READ ONLY; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:46.975000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:46.975000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:20.850000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:20.850000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; @@ -4891,7 +4891,7 @@ SET TRANSACTION READ ONLY; SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:46.975000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:20.850000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -5291,15 +5291,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; SET TRANSACTION READ ONLY; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.035000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.035000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:21.197000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:21.197000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.035000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:21.197000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -5645,15 +5645,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.088000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.088000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:21.478000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:21.478000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; SET SPANNER.READ_ONLY_STALENESS='EXACT_STALENESS 10s'; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.088000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:21.478000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -6093,8 +6093,8 @@ BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; ROLLBACK; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.171000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.171000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:21.844000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:21.844000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; @@ -6104,7 +6104,7 @@ BEGIN TRANSACTION; SELECT 1 AS TEST; ROLLBACK; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.171000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:21.844000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -6613,8 +6613,8 @@ BEGIN TRANSACTION; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.258000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.258000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:22.407000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:22.407000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; @@ -6624,7 +6624,7 @@ BEGIN TRANSACTION; SELECT 1 AS TEST; COMMIT; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.258000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:22.407000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -7029,15 +7029,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.317000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.317000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:22.697000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:22.697000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.317000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:22.697000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -7400,14 +7400,14 @@ SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.380000000Z'; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:23.054000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.380000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:23.054000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -7762,13 +7762,13 @@ SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.447000000Z'; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:23.432000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; SELECT 1 AS TEST; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.447000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:23.432000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -8082,14 +8082,14 @@ SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.499000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.499000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:23.761000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:23.761000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.499000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:23.761000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=FALSE; @@ -8399,13 +8399,13 @@ SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.546000000Z'; +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:24.025000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; START BATCH DDL; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.546000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:24.025000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; @@ -8760,8 +8760,8 @@ SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET TRANSACTION READ ONLY; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.598000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.598000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:24.320000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:24.320000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; @@ -8769,7 +8769,7 @@ SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SET TRANSACTION READ ONLY; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.598000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:24.320000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; @@ -9204,8 +9204,8 @@ SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; UPDATE foo SET bar=1; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.664000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.664000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:24.676000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:24.676000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; @@ -9213,8 +9213,8 @@ SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; UPDATE foo SET bar=1; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.664000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:47.664000000Z' +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:24.676000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:24.676000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; @@ -9600,15 +9600,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.717000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.717000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:24.973000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:24.973000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.717000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:24.973000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; @@ -9959,15 +9959,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.776000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.776000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:25.308000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:25.308000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; CREATE TABLE foo (id INT64 NOT NULL, name STRING(100)) PRIMARY KEY (id); -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.776000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:47.776000000Z' +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:25.308000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:25.308000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; @@ -10327,15 +10327,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; UPDATE foo SET bar=1; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.835000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.835000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:25.588000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:25.588000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; UPDATE foo SET bar=1; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.835000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:47.835000000Z' +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:25.588000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:25.588000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; @@ -10725,16 +10725,16 @@ SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.891000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.891000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:25.921000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:25.921000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; @EXPECT RESULT_SET 'TEST',1 SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.891000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:47.891000000Z' +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:25.921000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:25.921000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; @@ -11117,15 +11117,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:47.957000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:47.957000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:26.199000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:26.199000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:47.957000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:47.957000000Z' +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:26.199000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:26.199000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; @@ -11455,14 +11455,14 @@ SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:48.009000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:48.009000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:26.495000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:26.495000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:48.009000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:48.009000000Z' +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:26.495000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:26.495000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=FALSE; @@ -11785,15 +11785,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=TRUE; SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:48.058000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:48.058000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:26.744000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:26.744000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=TRUE; SET SPANNER.READ_ONLY_STALENESS='MAX_STALENESS 10s'; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:48.058000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:48.058000000Z' +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:26.744000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:26.744000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; @@ -12200,8 +12200,8 @@ SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SELECT 1 AS TEST; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:48.118000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:48.118000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:27.080000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:27.080000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; @@ -12209,8 +12209,8 @@ SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; SELECT 1 AS TEST; COMMIT; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:48.118000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:48.118000000Z' +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:27.080000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:27.080000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; @@ -12593,15 +12593,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:48.169000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:48.169000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:27.369000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:27.369000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=TRUE; BEGIN TRANSACTION; @EXPECT EXCEPTION FAILED_PRECONDITION -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:48.169000000Z'; +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:27.369000000Z'; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=TRUE; @@ -12939,15 +12939,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:48.260000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:48.260000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:27.669000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:27.669000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:48.260000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:48.260000000Z' +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:27.669000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:27.669000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; @@ -13294,15 +13294,15 @@ NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:48.315000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:48.315000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:27.959000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:27.959000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=TRUE; SELECT 1 AS TEST; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:48.315000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:48.315000000Z' +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:27.959000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:27.959000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; @@ -13619,14 +13619,14 @@ SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-25T15:13:48.369000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-25T15:13:48.369000000Z' +SET SPANNER.READ_ONLY_STALENESS='READ_TIMESTAMP 2024-03-26T15:31:28.213000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','READ_TIMESTAMP 2024-03-26T15:31:28.213000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; SET AUTOCOMMIT=TRUE; -SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-25T15:13:48.369000000Z'; -@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-25T15:13:48.369000000Z' +SET SPANNER.READ_ONLY_STALENESS='MIN_READ_TIMESTAMP 2024-03-26T15:31:28.213000000Z'; +@EXPECT RESULT_SET 'SPANNER.READ_ONLY_STALENESS','MIN_READ_TIMESTAMP 2024-03-26T15:31:28.213000000Z' SHOW VARIABLE SPANNER.READ_ONLY_STALENESS; NEW_CONNECTION; SET SPANNER.READONLY=TRUE; From d05695bc1c7bee9d734eb310ac2d5cb0ac95aaea Mon Sep 17 00:00:00 2001 From: Arpan Mishra Date: Tue, 2 Apr 2024 17:58:51 +0530 Subject: [PATCH 43/47] chore: minor improvements to default benchmarks. (#2993) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: minor improvements to default benchmarks. * chore: lint issues fix. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../spanner/AbstractLatencyBenchmark.java | 64 +++++++++++++++++-- .../cloud/spanner/DefaultBenchmark.java | 58 +++++------------ 2 files changed, 74 insertions(+), 48 deletions(-) diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractLatencyBenchmark.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractLatencyBenchmark.java index d7edf64030e..b57f3aa723d 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractLatencyBenchmark.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractLatencyBenchmark.java @@ -16,6 +16,7 @@ package com.google.cloud.spanner; +import com.google.common.base.MoreObjects; import java.time.Duration; import java.util.ArrayList; import java.util.Collections; @@ -24,6 +25,52 @@ public abstract class AbstractLatencyBenchmark { + static final String SELECT_QUERY = "SELECT ID FROM FOO WHERE ID = @id"; + static final String UPDATE_QUERY = "UPDATE FOO SET BAR=1 WHERE ID = @id"; + static final String ID_COLUMN_NAME = "id"; + + /** + * Used to determine how many concurrent requests are allowed. For ex - To simulate a low QPS + * scenario, using 1 thread means there will be 1 request. Use a value > 1 to have concurrent + * requests. + */ + static final int PARALLEL_THREADS = + Integer.valueOf( + MoreObjects.firstNonNull(System.getenv("SPANNER_TEST_JMH_NUM_PARALLEL_THREADS"), "30")); + + /** + * Total number of reads per test run for 1 thread. Increasing the value here will increase the + * duration of the benchmark. For ex - With PARALLEL_THREADS = 2, TOTAL_READS_PER_RUN = 200, there + * will be 400 read requests (200 on each thread). + */ + static final int TOTAL_READS_PER_RUN = + Integer.valueOf( + MoreObjects.firstNonNull( + System.getenv("SPANNER_TEST_JMH_NUM_READS_PER_THREAD"), "48000")); + + /** + * Total number of writes per test run for 1 thread. Increasing the value here will increase the + * duration of the benchmark. For ex - With PARALLEL_THREADS = 2, TOTAL_WRITES_PER_RUN = 200, + * there will be 400 write requests (200 on each thread). + */ + static final int TOTAL_WRITES_PER_RUN = + Integer.valueOf( + MoreObjects.firstNonNull( + System.getenv("SPANNER_TEST_JMH_NUM_WRITES_PER_THREAD"), "4000")); + + /** + * Number of requests which are used to initialise/warmup the benchmark. The latency number of + * these runs are ignored from the final reported results. + */ + static final int WARMUP_REQUEST_COUNT = 1; + + /** + * Numbers of records in the sample table used in the benchmark. This is used in this benchmark to + * randomly choose a primary key and ensure that the reads are randomly distributed. This is done + * to ensure we don't end up reading/writing the same table record (leading to hot-spotting). + */ + static final int TOTAL_RECORDS = 1000000; + /** Utility to print latency numbers. It computes metrics such as Average, P50, P95 and P99. */ public void printResults(List results) { if (results == null) { @@ -33,23 +80,23 @@ public void printResults(List results) { Collections.sort(orderedResults); System.out.println(); System.out.printf("Total number of queries: %d\n", orderedResults.size()); - System.out.printf("Avg: %fs\n", avg(results)); - System.out.printf("P50: %fs\n", percentile(50, orderedResults)); - System.out.printf("P95: %fs\n", percentile(95, orderedResults)); - System.out.printf("P99: %fs\n", percentile(99, orderedResults)); + System.out.printf("Avg: %fms\n", avg(results)); + System.out.printf("P50: %fms\n", percentile(50, orderedResults)); + System.out.printf("P95: %fms\n", percentile(95, orderedResults)); + System.out.printf("P99: %fms\n", percentile(99, orderedResults)); } private double percentile(int percentile, List orderedResults) { int index = percentile * orderedResults.size() / 100; Duration value = orderedResults.get(index); - Double convertedValue = convertDurationToFractionInSeconds(value); + Double convertedValue = convertDurationToFractionInMilliSeconds(value); return convertedValue; } /** Returns the average duration in seconds from a list of duration values. */ private double avg(List results) { return results.stream() - .collect(Collectors.averagingDouble(this::convertDurationToFractionInSeconds)); + .collect(Collectors.averagingDouble(this::convertDurationToFractionInMilliSeconds)); } private double convertDurationToFractionInSeconds(Duration duration) { @@ -59,4 +106,9 @@ private double convertDurationToFractionInSeconds(Duration duration) { double value = seconds + fraction; return value; } + + private double convertDurationToFractionInMilliSeconds(Duration duration) { + long nanoseconds = duration.toNanos(); + return nanoseconds / 1000000.0; + } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DefaultBenchmark.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DefaultBenchmark.java index 84578dd3231..d966d58dbd5 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DefaultBenchmark.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DefaultBenchmark.java @@ -18,6 +18,8 @@ import static com.google.cloud.spanner.BenchmarkingUtilityScripts.collectResults; import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import com.google.common.base.Stopwatch; import com.google.common.util.concurrent.ListenableFuture; @@ -37,6 +39,7 @@ import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; @@ -45,8 +48,8 @@ /** * Benchmarks for measuring existing latencies of various APIs using the Java Client. The benchmarks - * are bound to the Maven profile `benchmark` and can be executed like this: mvn clean test - * -DskipTests -Pbenchmark -Dbenchmark.name=DefaultBenchmark + * are bound to the Maven profile `benchmark` and can be executed like this: + * mvn clean test -DskipTests -Pbenchmark -Dbenchmark.name=DefaultBenchmark * Test Table Schema : * *

CREATE TABLE FOO ( id INT64 NOT NULL, BAZ INT64, BAR INT64, ) PRIMARY KEY(id); @@ -63,47 +66,9 @@ @Fork(value = 1, warmups = 0) @Measurement(batchSize = 1, iterations = 1, timeUnit = TimeUnit.MILLISECONDS) @OutputTimeUnit(TimeUnit.SECONDS) -@Warmup(iterations = 1) +@Warmup(iterations = 0) public class DefaultBenchmark extends AbstractLatencyBenchmark { - private static final String SELECT_QUERY = "SELECT ID FROM FOO WHERE ID = @id"; - private static final String UPDATE_QUERY = "UPDATE FOO SET BAR=1 WHERE ID = @id"; - private static final String ID_COLUMN_NAME = "id"; - - /** - * Used to determine how many concurrent requests are allowed. For ex - To simulate a low QPS - * scenario, using 1 thread means there will be 1 request. Use a value > 1 to have concurrent - * requests. - */ - private static final int PARALLEL_THREADS = 1; - - /** - * Total number of reads per test run for 1 thread. Increasing the value here will increase the - * duration of the benchmark. For ex - With PARALLEL_THREADS = 2, TOTAL_READS_PER_RUN = 200, there - * will be 400 read requests (200 on each thread). - */ - private static final int TOTAL_READS_PER_RUN = 12000; - - /** - * Total number of writes per test run for 1 thread. Increasing the value here will increase the - * duration of the benchmark. For ex - With PARALLEL_THREADS = 2, TOTAL_WRITES_PER_RUN = 200, - * there will be 400 write requests (200 on each thread). - */ - private static final int TOTAL_WRITES_PER_RUN = 4000; - - /** - * Number of requests which are used to initialise/warmup the benchmark. The latency number of - * these runs are ignored from the final reported results. - */ - private static final int WARMUP_REQUEST_COUNT = 1; - - /** - * Numbers of records in the sample table used in the benchmark. This is used in this benchmark to - * randomly choose a primary key and ensure that the reads are randomly distributed. This is done - * to ensure we don't end up reading/writing the same table record (leading to hot-spotting). - */ - private static final int TOTAL_RECORDS = 1000000; - @State(Scope.Thread) @AuxCounters(org.openjdk.jmh.annotations.AuxCounters.Type.EVENTS) public static class BenchmarkState { @@ -115,12 +80,20 @@ public static class BenchmarkState { private Spanner spanner; private DatabaseClientImpl client; + @Param({"100"}) + int minSessions; + + @Param({"400"}) + int maxSessions; + @Setup(Level.Iteration) public void setup() throws Exception { SpannerOptions options = SpannerOptions.newBuilder() .setSessionPoolOption( SessionPoolOptions.newBuilder() + .setMinSessions(minSessions) + .setMaxSessions(maxSessions) .setWaitForMinSessions(org.threeten.bp.Duration.ofSeconds(20)) .build()) .setHost(SERVER_URL) @@ -217,7 +190,8 @@ private java.time.Duration executeQuery(final BenchmarkState server) { try (ResultSet rs = server.client.singleUse().executeQuery(getRandomisedReadStatement())) { while (rs.next()) { - int count = rs.getColumnCount(); + assertEquals(1, rs.getColumnCount()); + assertNotNull(rs.getValue(0)); } } return watch.elapsed(); From 417a83c375a4e9e464b33dfda8b80e2169f5b436 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 3 Apr 2024 06:50:22 +0200 Subject: [PATCH 44/47] build(deps): update dependency org.jacoco:jacoco-maven-plugin to v0.8.12 (#2996) --- google-cloud-spanner/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index d3e459a7f63..65d188f95d8 100644 --- a/google-cloud-spanner/pom.xml +++ b/google-cloud-spanner/pom.xml @@ -29,7 +29,7 @@ org.jacoco jacoco-maven-plugin - 0.8.11 + 0.8.12 From 2d6f4f3d31ffd7bc2168d26a55c18ed11c451684 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 3 Apr 2024 10:21:18 +0530 Subject: [PATCH 45/47] chore: add regex to match unmanaged dependency check (#1941) (#2971) Source-Link: https://github.com/googleapis/synthtool/commit/ca7a71650b000f900236f54a0f9bd322fd1b2adf Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:cecae6152a85d55c932a64515643cf2e32a1f1b6e17503080eb07744b2177f28 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- renovate.json | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b9c5b09c7f5..d7b8a2d87b1 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:1fb09a3eb66af09221da69087fd1b4d075bc7c79e508d0708f5dc0f842069da2 -# created: 2024-02-05T19:43:08.106031548Z + digest: sha256:cecae6152a85d55c932a64515643cf2e32a1f1b6e17503080eb07744b2177f28 +# created: 2024-03-25T17:31:37.187420732Z diff --git a/renovate.json b/renovate.json index b5cf3239c07..8715fe4dff7 100644 --- a/renovate.json +++ b/renovate.json @@ -23,6 +23,15 @@ "matchStrings": ["value: \"gcr.io/cloud-devrel-public-resources/graalvm.*:(?.*?)\""], "depNameTemplate": "com.google.cloud:sdk-platform-java-config", "datasourceTemplate": "maven" + }, + { + "customType": "regex", + "fileMatch": [ + "^.github/workflows/unmanaged_dependency_check.yaml$" + ], + "matchStrings": ["uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v(?.+?)\\n"], + "depNameTemplate": "com.google.cloud:sdk-platform-java-config", + "datasourceTemplate": "maven" } ], "packageRules": [ From d2b48620d2b6c23047f6917a67418f7d859b06fc Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 3 Apr 2024 10:28:26 +0530 Subject: [PATCH 46/47] feat: Add SessionPoolOptions, SpannerOptions protos in executor protos (#2932) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add instance partition support to spanner instance proto PiperOrigin-RevId: 611127452 Source-Link: https://github.com/googleapis/googleapis/commit/618d47cf1e3dc4970aaec81e417039fc9d62bfdc Source-Link: https://github.com/googleapis/googleapis-gen/commit/92d855588828430e8b428ed78219e23ee666da78 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTJkODU1NTg4ODI4NDMwZThiNDI4ZWQ3ODIxOWUyM2VlNjY2ZGE3OCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix(deps): Update the Java code generator (gapic-generator-java) to 2.37.0 PiperOrigin-RevId: 611816371 Source-Link: https://github.com/googleapis/googleapis/commit/2a40f63ea714c7f4c6856a5db4d1f3cc7d4c4b18 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d30ff0767777b381fb1617f67a90e3abd3bdc6dc Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDMwZmYwNzY3Nzc3YjM4MWZiMTYxN2Y2N2E5MGUzYWJkM2JkYzZkYyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: Add SessionPoolOptions, SpannerOptions protos in executor protos PiperOrigin-RevId: 621265883 Source-Link: https://github.com/googleapis/googleapis/commit/fed9845c564d6acf8d03beee69b36666c8bd7fa4 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c66a76957e2e16347bc1dd3f4c638223f065ee80 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzY2YTc2OTU3ZTJlMTYzNDdiYzFkZDNmNGM2MzgyMjNmMDY1ZWU4MCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../reflect-config.json | 251 +- .../database/v1/DatabaseAdminSettings.java | 2 - .../v1/stub/DatabaseAdminStubSettings.java | 12 - .../HttpJsonDatabaseAdminCallableFactory.java | 4 - .../v1/stub/HttpJsonDatabaseAdminStub.java | 2 - .../instance/v1/InstanceAdminClient.java | 1628 +++++++- .../instance/v1/InstanceAdminSettings.java | 130 +- .../admin/instance/v1/gapic_metadata.json | 18 + .../v1/stub/GrpcInstanceAdminStub.java | 299 ++ .../HttpJsonInstanceAdminCallableFactory.java | 4 - .../v1/stub/HttpJsonInstanceAdminStub.java | 488 ++- .../instance/v1/stub/InstanceAdminStub.java | 71 + .../v1/stub/InstanceAdminStubSettings.java | 461 ++- .../cloud/spanner/v1/SpannerSettings.java | 2 - .../stub/HttpJsonSpannerCallableFactory.java | 4 - .../spanner/v1/stub/HttpJsonSpannerStub.java | 2 - .../reflect-config.json | 207 + .../v1/InstanceAdminClientHttpJsonTest.java | 613 +++ .../instance/v1/InstanceAdminClientTest.java | 550 +++ .../instance/v1/MockInstanceAdminImpl.java | 137 + .../admin/instance/v1/InstanceAdminGrpc.java | 1114 +++++- .../v1/CreateInstancePartitionMetadata.java | 1579 ++++++++ ...ateInstancePartitionMetadataOrBuilder.java | 178 + .../v1/CreateInstancePartitionRequest.java | 1202 ++++++ ...eateInstancePartitionRequestOrBuilder.java | 135 + .../v1/DeleteInstancePartitionRequest.java | 871 +++++ ...leteInstancePartitionRequestOrBuilder.java | 90 + .../v1/GetInstancePartitionRequest.java | 663 ++++ .../GetInstancePartitionRequestOrBuilder.java | 59 + .../admin/instance/v1/InstancePartition.java | 3330 +++++++++++++++++ .../instance/v1/InstancePartitionName.java | 231 ++ .../v1/InstancePartitionOrBuilder.java | 485 +++ ...istInstancePartitionOperationsRequest.java | 1816 +++++++++ ...cePartitionOperationsRequestOrBuilder.java | 266 ++ ...stInstancePartitionOperationsResponse.java | 1571 ++++++++ ...ePartitionOperationsResponseOrBuilder.java | 189 + .../v1/ListInstancePartitionsRequest.java | 1331 +++++++ ...istInstancePartitionsRequestOrBuilder.java | 158 + .../v1/ListInstancePartitionsResponse.java | 1507 ++++++++ ...stInstancePartitionsResponseOrBuilder.java | 177 + .../instance/v1/ListInstancesRequest.java | 343 +- .../v1/ListInstancesRequestOrBuilder.java | 50 + .../instance/v1/ListInstancesResponse.java | 316 ++ .../v1/ListInstancesResponseOrBuilder.java | 63 + .../v1/SpannerInstanceAdminProto.java | 489 ++- .../v1/UpdateInstancePartitionMetadata.java | 1579 ++++++++ ...ateInstancePartitionMetadataOrBuilder.java | 178 + .../v1/UpdateInstancePartitionRequest.java | 1139 ++++++ ...dateInstancePartitionRequestOrBuilder.java | 129 + .../instance/v1/spanner_instance_admin.proto | 558 ++- .../spanner/executor/v1/AdminAction.java | 208 +- .../executor/v1/AdminActionOrBuilder.java | 24 +- ...a => ChangeQuorumCloudDatabaseAction.java} | 146 +- ...geQuorumCloudDatabaseActionOrBuilder.java} | 10 +- .../executor/v1/CloudExecutorProto.java | 905 ++--- .../executor/v1/CreateCloudBackupAction.java | 289 ++ .../v1/CreateCloudBackupActionOrBuilder.java | 38 + .../v1/RestoreCloudDatabaseAction.java | 302 +- .../RestoreCloudDatabaseActionOrBuilder.java | 38 + .../executor/v1/SessionPoolOptions.java | 539 +++ .../v1/SessionPoolOptionsOrBuilder.java | 40 + .../spanner/executor/v1/SpannerAction.java | 284 +- .../executor/v1/SpannerActionOrBuilder.java | 35 + .../spanner/executor/v1/SpannerOptions.java | 730 ++++ .../executor/v1/SpannerOptionsOrBuilder.java | 61 + .../spanner/executor/v1/cloud_executor.proto | 34 +- 66 files changed, 29528 insertions(+), 836 deletions(-) create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionMetadata.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionMetadataOrBuilder.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionRequest.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionRequestOrBuilder.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/DeleteInstancePartitionRequest.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/DeleteInstancePartitionRequestOrBuilder.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/GetInstancePartitionRequest.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/GetInstancePartitionRequestOrBuilder.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstancePartition.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstancePartitionName.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstancePartitionOrBuilder.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsRequest.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsRequestOrBuilder.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsResponse.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsResponseOrBuilder.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsRequest.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsRequestOrBuilder.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsResponse.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsResponseOrBuilder.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionMetadata.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionMetadataOrBuilder.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionRequest.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionRequestOrBuilder.java rename proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/{ReconfigureCloudDatabaseAction.java => ChangeQuorumCloudDatabaseAction.java} (80%) rename proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/{ReconfigureCloudDatabaseActionOrBuilder.java => ChangeQuorumCloudDatabaseActionOrBuilder.java} (89%) create mode 100644 proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SessionPoolOptions.java create mode 100644 proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SessionPoolOptionsOrBuilder.java create mode 100644 proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerOptions.java create mode 100644 proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerOptionsOrBuilder.java diff --git a/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json b/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json index 66b9c40db43..71898e0bba2 100644 --- a/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json +++ b/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json @@ -2600,6 +2600,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.CreateInstanceRequest", "queryAllDeclaredConstructors": true, @@ -2636,6 +2672,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.DeleteInstanceRequest", "queryAllDeclaredConstructors": true, @@ -2672,6 +2726,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.GetInstancePartitionRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.GetInstancePartitionRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.GetInstanceRequest", "queryAllDeclaredConstructors": true, @@ -2753,6 +2825,33 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.InstancePartition", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.InstancePartition$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.InstancePartition$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest", "queryAllDeclaredConstructors": true, @@ -2825,6 +2924,78 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.ListInstancesRequest", "queryAllDeclaredConstructors": true, @@ -2960,6 +3131,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.UpdateInstanceRequest", "queryAllDeclaredConstructors": true, @@ -3068,6 +3275,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.executor.v1.ChangeStreamRecord", "queryAllDeclaredConstructors": true, @@ -4059,7 +4284,7 @@ "allPublicClasses": true }, { - "name": "com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction", + "name": "com.google.spanner.executor.v1.RestoreCloudDatabaseAction", "queryAllDeclaredConstructors": true, "queryAllPublicConstructors": true, "queryAllDeclaredMethods": true, @@ -4068,7 +4293,7 @@ "allPublicClasses": true }, { - "name": "com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction$Builder", + "name": "com.google.spanner.executor.v1.RestoreCloudDatabaseAction$Builder", "queryAllDeclaredConstructors": true, "queryAllPublicConstructors": true, "queryAllDeclaredMethods": true, @@ -4077,7 +4302,7 @@ "allPublicClasses": true }, { - "name": "com.google.spanner.executor.v1.RestoreCloudDatabaseAction", + "name": "com.google.spanner.executor.v1.SessionPoolOptions", "queryAllDeclaredConstructors": true, "queryAllPublicConstructors": true, "queryAllDeclaredMethods": true, @@ -4086,7 +4311,7 @@ "allPublicClasses": true }, { - "name": "com.google.spanner.executor.v1.RestoreCloudDatabaseAction$Builder", + "name": "com.google.spanner.executor.v1.SessionPoolOptions$Builder", "queryAllDeclaredConstructors": true, "queryAllPublicConstructors": true, "queryAllDeclaredMethods": true, @@ -4166,6 +4391,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.executor.v1.SpannerOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.executor.v1.SpannerOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.executor.v1.StartBatchTransactionAction", "queryAllDeclaredConstructors": true, diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminSettings.java index 8cfb9c5455b..50d6900e1ce 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminSettings.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminSettings.java @@ -317,7 +317,6 @@ public static Builder newBuilder() { } /** Returns a new REST builder for this class. */ - @BetaApi public static Builder newHttpJsonBuilder() { return Builder.createHttpJsonDefault(); } @@ -359,7 +358,6 @@ private static Builder createDefault() { return new Builder(DatabaseAdminStubSettings.newBuilder()); } - @BetaApi private static Builder createHttpJsonDefault() { return new Builder(DatabaseAdminStubSettings.newHttpJsonBuilder()); } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java index 31da17aad8f..68432959c50 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java @@ -1329,8 +1329,6 @@ public UnaryCallSettings.Builder createDatabas } /** Returns the builder for the settings used for calls to createDatabase. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder createDatabaseOperationSettings() { return createDatabaseOperationSettings; @@ -1347,8 +1345,6 @@ public UnaryCallSettings.Builder updateDatabas } /** Returns the builder for the settings used for calls to updateDatabase. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder updateDatabaseOperationSettings() { return updateDatabaseOperationSettings; @@ -1361,8 +1357,6 @@ public UnaryCallSettings.Builder updateDatabas } /** Returns the builder for the settings used for calls to updateDatabaseDdl. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder updateDatabaseDdlOperationSettings() { return updateDatabaseDdlOperationSettings; @@ -1401,8 +1395,6 @@ public UnaryCallSettings.Builder createBackupSet } /** Returns the builder for the settings used for calls to createBackup. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder createBackupOperationSettings() { return createBackupOperationSettings; @@ -1414,8 +1406,6 @@ public UnaryCallSettings.Builder copyBackupSetting } /** Returns the builder for the settings used for calls to copyBackup. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder copyBackupOperationSettings() { return copyBackupOperationSettings; @@ -1449,8 +1439,6 @@ public UnaryCallSettings.Builder restoreDatab } /** Returns the builder for the settings used for calls to restoreDatabase. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder restoreDatabaseOperationSettings() { return restoreDatabaseOperationSettings; diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/HttpJsonDatabaseAdminCallableFactory.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/HttpJsonDatabaseAdminCallableFactory.java index c8e151ea681..9f8c8075f66 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/HttpJsonDatabaseAdminCallableFactory.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/HttpJsonDatabaseAdminCallableFactory.java @@ -16,7 +16,6 @@ package com.google.cloud.spanner.admin.database.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.httpjson.HttpJsonCallSettings; import com.google.api.gax.httpjson.HttpJsonCallableFactory; import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; @@ -41,7 +40,6 @@ *

This class is for advanced usage. */ @Generated("by gapic-generator-java") -@BetaApi public class HttpJsonDatabaseAdminCallableFactory implements HttpJsonStubCallableFactory { @@ -73,8 +71,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/HttpJsonDatabaseAdminStub.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/HttpJsonDatabaseAdminStub.java index 9f30149bac6..1eaa5055133 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/HttpJsonDatabaseAdminStub.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/HttpJsonDatabaseAdminStub.java @@ -23,7 +23,6 @@ import static com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient.ListDatabasesPagedResponse; import com.google.api.HttpRule; -import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -94,7 +93,6 @@ *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator-java") -@BetaApi public class HttpJsonDatabaseAdminStub extends DatabaseAdminStub { private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder() diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClient.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClient.java index 9461d953b87..2e08751ff12 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClient.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClient.java @@ -43,25 +43,37 @@ import com.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata; import com.google.spanner.admin.instance.v1.CreateInstanceConfigRequest; import com.google.spanner.admin.instance.v1.CreateInstanceMetadata; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.CreateInstanceRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceRequest; import com.google.spanner.admin.instance.v1.GetInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.GetInstancePartitionRequest; import com.google.spanner.admin.instance.v1.GetInstanceRequest; import com.google.spanner.admin.instance.v1.Instance; import com.google.spanner.admin.instance.v1.InstanceConfig; import com.google.spanner.admin.instance.v1.InstanceConfigName; import com.google.spanner.admin.instance.v1.InstanceName; +import com.google.spanner.admin.instance.v1.InstancePartition; +import com.google.spanner.admin.instance.v1.InstancePartitionName; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse; import com.google.spanner.admin.instance.v1.ListInstanceConfigsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse; import com.google.spanner.admin.instance.v1.ListInstancesRequest; import com.google.spanner.admin.instance.v1.ListInstancesResponse; import com.google.spanner.admin.instance.v1.ProjectName; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceMetadata; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceRequest; import java.io.IOException; import java.util.List; @@ -270,6 +282,26 @@ * * * + *

ListInstancePartitions + *

Lists all instance partitions for the given instance. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • listInstancePartitions(ListInstancePartitionsRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • listInstancePartitions(InstanceName parent) + *

  • listInstancePartitions(String parent) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • listInstancePartitionsPagedCallable() + *

  • listInstancePartitionsCallable() + *

+ * + * + * *

GetInstance *

Gets information about a particular instance. * @@ -425,6 +457,120 @@ * * * + * + *

GetInstancePartition + *

Gets information about a particular instance partition. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • getInstancePartition(GetInstancePartitionRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • getInstancePartition(InstancePartitionName name) + *

  • getInstancePartition(String name) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • getInstancePartitionCallable() + *

+ * + * + * + *

CreateInstancePartition + *

Creates an instance partition and begins preparing it to be used. The returned [long-running operation][google.longrunning.Operation] can be used to track the progress of preparing the new instance partition. The instance partition name is assigned by the caller. If the named instance partition already exists, `CreateInstancePartition` returns `ALREADY_EXISTS`. + *

Immediately upon completion of this request: + *

* The instance partition is readable via the API, with all requested attributes but no allocated resources. Its state is `CREATING`. + *

Until completion of the returned operation: + *

* Cancelling the operation renders the instance partition immediately unreadable via the API. * The instance partition can be deleted. * All other attempts to modify the instance partition are rejected. + *

Upon completion of the returned operation: + *

* Billing for all successfully-allocated resources begins (some types may have lower than the requested levels). * Databases can start using this instance partition. * The instance partition's allocated resource levels are readable via the API. * The instance partition's state becomes `READY`. + *

The returned [long-running operation][google.longrunning.Operation] will have a name of the format `<instance_partition_name>/operations/<operation_id>` and can be used to track creation of the instance partition. The [metadata][google.longrunning.Operation.metadata] field type is [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. The [response][google.longrunning.Operation.response] field type is [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • createInstancePartitionAsync(CreateInstancePartitionRequest request) + *

+ *

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

+ *
    + *
  • createInstancePartitionAsync(InstanceName parent, InstancePartition instancePartition, String instancePartitionId) + *

  • createInstancePartitionAsync(String parent, InstancePartition instancePartition, String instancePartitionId) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • createInstancePartitionOperationCallable() + *

  • createInstancePartitionCallable() + *

+ * + * + * + *

DeleteInstancePartition + *

Deletes an existing instance partition. Requires that the instance partition is not used by any database or backup and is not the default instance partition of an instance. + *

Authorization requires `spanner.instancePartitions.delete` permission on the resource [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • deleteInstancePartition(DeleteInstancePartitionRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • deleteInstancePartition(InstancePartitionName name) + *

  • deleteInstancePartition(String name) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • deleteInstancePartitionCallable() + *

+ * + * + * + *

UpdateInstancePartition + *

Updates an instance partition, and begins allocating or releasing resources as requested. The returned [long-running operation][google.longrunning.Operation] can be used to track the progress of updating the instance partition. If the named instance partition does not exist, returns `NOT_FOUND`. + *

Immediately upon completion of this request: + *

* For resource types for which a decrease in the instance partition's allocation has been requested, billing is based on the newly-requested level. + *

Until completion of the returned operation: + *

* Cancelling the operation sets its metadata's [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with a `CANCELLED` status. * All other attempts to modify the instance partition are rejected. * Reading the instance partition via the API continues to give the pre-request resource levels. + *

Upon completion of the returned operation: + *

* Billing begins for all successfully-allocated resources (some types may have lower than the requested levels). * All newly-reserved resources are available for serving the instance partition's tables. * The instance partition's new resource levels are readable via the API. + *

The returned [long-running operation][google.longrunning.Operation] will have a name of the format `<instance_partition_name>/operations/<operation_id>` and can be used to track the instance partition modification. The [metadata][google.longrunning.Operation.metadata] field type is [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. The [response][google.longrunning.Operation.response] field type is [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful. + *

Authorization requires `spanner.instancePartitions.update` permission on the resource [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • updateInstancePartitionAsync(UpdateInstancePartitionRequest request) + *

+ *

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

+ *
    + *
  • updateInstancePartitionAsync(InstancePartition instancePartition, FieldMask fieldMask) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • updateInstancePartitionOperationCallable() + *

  • updateInstancePartitionCallable() + *

+ * + * + * + *

ListInstancePartitionOperations + *

Lists instance partition [long-running operations][google.longrunning.Operation] in the given instance. An instance partition operation has a name of the form `projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>`. The long-running operation [metadata][google.longrunning.Operation.metadata] field type `metadata.type_url` describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by `operation.metadata.value.start_time` in descending order starting from the most recently started operation. + *

Authorization requires `spanner.instancePartitionOperations.list` permission on the resource [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ *
    + *
  • listInstancePartitionOperations(ListInstancePartitionOperationsRequest request) + *

+ *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ *
    + *
  • listInstancePartitionOperations(InstanceName parent) + *

  • listInstancePartitionOperations(String parent) + *

+ *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • listInstancePartitionOperationsPagedCallable() + *

  • listInstancePartitionOperationsCallable() + *

+ * + * * * *

See the individual methods for example code. @@ -1899,6 +2045,7 @@ public final ListInstancesPagedResponse listInstances(String parent) { * .setPageSize(883849137) * .setPageToken("pageToken873572522") * .setFilter("filter-1274492040") + * .setInstanceDeadline(Timestamp.newBuilder().build()) * .build(); * for (Instance element : instanceAdminClient.listInstances(request).iterateAll()) { * // doThingsWith(element); @@ -1932,6 +2079,7 @@ public final ListInstancesPagedResponse listInstances(ListInstancesRequest reque * .setPageSize(883849137) * .setPageToken("pageToken873572522") * .setFilter("filter-1274492040") + * .setInstanceDeadline(Timestamp.newBuilder().build()) * .build(); * ApiFuture future = * instanceAdminClient.listInstancesPagedCallable().futureCall(request); @@ -1966,6 +2114,7 @@ public final ListInstancesPagedResponse listInstances(ListInstancesRequest reque * .setPageSize(883849137) * .setPageToken("pageToken873572522") * .setFilter("filter-1274492040") + * .setInstanceDeadline(Timestamp.newBuilder().build()) * .build(); * while (true) { * ListInstancesResponse response = instanceAdminClient.listInstancesCallable().call(request); @@ -1986,6 +2135,180 @@ public final UnaryCallable listInst return stub.listInstancesCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all instance partitions for the given instance. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+   *   for (InstancePartition element :
+   *       instanceAdminClient.listInstancePartitions(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The instance whose instance partitions should be listed. Values are of + * the form `projects/<project>/instances/<instance>`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListInstancePartitionsPagedResponse listInstancePartitions(InstanceName parent) { + ListInstancePartitionsRequest request = + ListInstancePartitionsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listInstancePartitions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all instance partitions for the given instance. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+   *   for (InstancePartition element :
+   *       instanceAdminClient.listInstancePartitions(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The instance whose instance partitions should be listed. Values are of + * the form `projects/<project>/instances/<instance>`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListInstancePartitionsPagedResponse listInstancePartitions(String parent) { + ListInstancePartitionsRequest request = + ListInstancePartitionsRequest.newBuilder().setParent(parent).build(); + return listInstancePartitions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all instance partitions for the given instance. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   ListInstancePartitionsRequest request =
+   *       ListInstancePartitionsRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setInstancePartitionDeadline(Timestamp.newBuilder().build())
+   *           .build();
+   *   for (InstancePartition element :
+   *       instanceAdminClient.listInstancePartitions(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListInstancePartitionsPagedResponse listInstancePartitions( + ListInstancePartitionsRequest request) { + return listInstancePartitionsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all instance partitions for the given instance. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   ListInstancePartitionsRequest request =
+   *       ListInstancePartitionsRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setInstancePartitionDeadline(Timestamp.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       instanceAdminClient.listInstancePartitionsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (InstancePartition element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listInstancePartitionsPagedCallable() { + return stub.listInstancePartitionsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all instance partitions for the given instance. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   ListInstancePartitionsRequest request =
+   *       ListInstancePartitionsRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setInstancePartitionDeadline(Timestamp.newBuilder().build())
+   *           .build();
+   *   while (true) {
+   *     ListInstancePartitionsResponse response =
+   *         instanceAdminClient.listInstancePartitionsCallable().call(request);
+   *     for (InstancePartition element : response.getInstancePartitionsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listInstancePartitionsCallable() { + return stub.listInstancePartitionsCallable(); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets information about a particular instance. @@ -3227,24 +3550,1116 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq return stub.testIamPermissionsCallable(); } - @Override - public final void close() { - stub.close(); - } - - @Override - public void shutdown() { - stub.shutdown(); + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a particular instance partition. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   InstancePartitionName name =
+   *       InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]");
+   *   InstancePartition response = instanceAdminClient.getInstancePartition(name);
+   * }
+   * }
+ * + * @param name Required. The name of the requested instance partition. Values are of the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final InstancePartition getInstancePartition(InstancePartitionName name) { + GetInstancePartitionRequest request = + GetInstancePartitionRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getInstancePartition(request); } - @Override - public boolean isShutdown() { - return stub.isShutdown(); + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a particular instance partition. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   String name =
+   *       InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]").toString();
+   *   InstancePartition response = instanceAdminClient.getInstancePartition(name);
+   * }
+   * }
+ * + * @param name Required. The name of the requested instance partition. Values are of the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final InstancePartition getInstancePartition(String name) { + GetInstancePartitionRequest request = + GetInstancePartitionRequest.newBuilder().setName(name).build(); + return getInstancePartition(request); } - @Override - public boolean isTerminated() { - return stub.isTerminated(); + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a particular instance partition. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   GetInstancePartitionRequest request =
+   *       GetInstancePartitionRequest.newBuilder()
+   *           .setName(
+   *               InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]")
+   *                   .toString())
+   *           .build();
+   *   InstancePartition response = instanceAdminClient.getInstancePartition(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final InstancePartition getInstancePartition(GetInstancePartitionRequest request) { + return getInstancePartitionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a particular instance partition. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   GetInstancePartitionRequest request =
+   *       GetInstancePartitionRequest.newBuilder()
+   *           .setName(
+   *               InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future =
+   *       instanceAdminClient.getInstancePartitionCallable().futureCall(request);
+   *   // Do something.
+   *   InstancePartition response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + getInstancePartitionCallable() { + return stub.getInstancePartitionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates an instance partition and begins preparing it to be used. The returned [long-running + * operation][google.longrunning.Operation] can be used to track the progress of preparing the new + * instance partition. The instance partition name is assigned by the caller. If the named + * instance partition already exists, `CreateInstancePartition` returns `ALREADY_EXISTS`. + * + *

Immediately upon completion of this request: + * + *

* The instance partition is readable via the API, with all requested attributes but no + * allocated resources. Its state is `CREATING`. + * + *

Until completion of the returned operation: + * + *

* Cancelling the operation renders the instance partition immediately unreadable via the + * API. * The instance partition can be deleted. * All other attempts to modify the + * instance partition are rejected. + * + *

Upon completion of the returned operation: + * + *

* Billing for all successfully-allocated resources begins (some types may have lower + * than the requested levels). * Databases can start using this instance partition. * The + * instance partition's allocated resource levels are readable via the API. * The instance + * partition's state becomes `READY`. + * + *

The returned [long-running operation][google.longrunning.Operation] will have a name of the + * format `<instance_partition_name>/operations/<operation_id>` and can be used to + * track creation of the instance partition. The [metadata][google.longrunning.Operation.metadata] + * field type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+   *   InstancePartition instancePartition = InstancePartition.newBuilder().build();
+   *   String instancePartitionId = "instancePartitionId1364450768";
+   *   InstancePartition response =
+   *       instanceAdminClient
+   *           .createInstancePartitionAsync(parent, instancePartition, instancePartitionId)
+   *           .get();
+   * }
+   * }
+ * + * @param parent Required. The name of the instance in which to create the instance partition. + * Values are of the form `projects/<project>/instances/<instance>`. + * @param instancePartition Required. The instance partition to create. The + * instance_partition.name may be omitted, but if specified must be + * `<parent>/instancePartitions/<instance_partition_id>`. + * @param instancePartitionId Required. The ID of the instance partition to create. Valid + * identifiers are of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture + createInstancePartitionAsync( + InstanceName parent, InstancePartition instancePartition, String instancePartitionId) { + CreateInstancePartitionRequest request = + CreateInstancePartitionRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setInstancePartition(instancePartition) + .setInstancePartitionId(instancePartitionId) + .build(); + return createInstancePartitionAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates an instance partition and begins preparing it to be used. The returned [long-running + * operation][google.longrunning.Operation] can be used to track the progress of preparing the new + * instance partition. The instance partition name is assigned by the caller. If the named + * instance partition already exists, `CreateInstancePartition` returns `ALREADY_EXISTS`. + * + *

Immediately upon completion of this request: + * + *

* The instance partition is readable via the API, with all requested attributes but no + * allocated resources. Its state is `CREATING`. + * + *

Until completion of the returned operation: + * + *

* Cancelling the operation renders the instance partition immediately unreadable via the + * API. * The instance partition can be deleted. * All other attempts to modify the + * instance partition are rejected. + * + *

Upon completion of the returned operation: + * + *

* Billing for all successfully-allocated resources begins (some types may have lower + * than the requested levels). * Databases can start using this instance partition. * The + * instance partition's allocated resource levels are readable via the API. * The instance + * partition's state becomes `READY`. + * + *

The returned [long-running operation][google.longrunning.Operation] will have a name of the + * format `<instance_partition_name>/operations/<operation_id>` and can be used to + * track creation of the instance partition. The [metadata][google.longrunning.Operation.metadata] + * field type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+   *   InstancePartition instancePartition = InstancePartition.newBuilder().build();
+   *   String instancePartitionId = "instancePartitionId1364450768";
+   *   InstancePartition response =
+   *       instanceAdminClient
+   *           .createInstancePartitionAsync(parent, instancePartition, instancePartitionId)
+   *           .get();
+   * }
+   * }
+ * + * @param parent Required. The name of the instance in which to create the instance partition. + * Values are of the form `projects/<project>/instances/<instance>`. + * @param instancePartition Required. The instance partition to create. The + * instance_partition.name may be omitted, but if specified must be + * `<parent>/instancePartitions/<instance_partition_id>`. + * @param instancePartitionId Required. The ID of the instance partition to create. Valid + * identifiers are of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture + createInstancePartitionAsync( + String parent, InstancePartition instancePartition, String instancePartitionId) { + CreateInstancePartitionRequest request = + CreateInstancePartitionRequest.newBuilder() + .setParent(parent) + .setInstancePartition(instancePartition) + .setInstancePartitionId(instancePartitionId) + .build(); + return createInstancePartitionAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates an instance partition and begins preparing it to be used. The returned [long-running + * operation][google.longrunning.Operation] can be used to track the progress of preparing the new + * instance partition. The instance partition name is assigned by the caller. If the named + * instance partition already exists, `CreateInstancePartition` returns `ALREADY_EXISTS`. + * + *

Immediately upon completion of this request: + * + *

* The instance partition is readable via the API, with all requested attributes but no + * allocated resources. Its state is `CREATING`. + * + *

Until completion of the returned operation: + * + *

* Cancelling the operation renders the instance partition immediately unreadable via the + * API. * The instance partition can be deleted. * All other attempts to modify the + * instance partition are rejected. + * + *

Upon completion of the returned operation: + * + *

* Billing for all successfully-allocated resources begins (some types may have lower + * than the requested levels). * Databases can start using this instance partition. * The + * instance partition's allocated resource levels are readable via the API. * The instance + * partition's state becomes `READY`. + * + *

The returned [long-running operation][google.longrunning.Operation] will have a name of the + * format `<instance_partition_name>/operations/<operation_id>` and can be used to + * track creation of the instance partition. The [metadata][google.longrunning.Operation.metadata] + * field type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   CreateInstancePartitionRequest request =
+   *       CreateInstancePartitionRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setInstancePartitionId("instancePartitionId1364450768")
+   *           .setInstancePartition(InstancePartition.newBuilder().build())
+   *           .build();
+   *   InstancePartition response = instanceAdminClient.createInstancePartitionAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture + createInstancePartitionAsync(CreateInstancePartitionRequest request) { + return createInstancePartitionOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates an instance partition and begins preparing it to be used. The returned [long-running + * operation][google.longrunning.Operation] can be used to track the progress of preparing the new + * instance partition. The instance partition name is assigned by the caller. If the named + * instance partition already exists, `CreateInstancePartition` returns `ALREADY_EXISTS`. + * + *

Immediately upon completion of this request: + * + *

* The instance partition is readable via the API, with all requested attributes but no + * allocated resources. Its state is `CREATING`. + * + *

Until completion of the returned operation: + * + *

* Cancelling the operation renders the instance partition immediately unreadable via the + * API. * The instance partition can be deleted. * All other attempts to modify the + * instance partition are rejected. + * + *

Upon completion of the returned operation: + * + *

* Billing for all successfully-allocated resources begins (some types may have lower + * than the requested levels). * Databases can start using this instance partition. * The + * instance partition's allocated resource levels are readable via the API. * The instance + * partition's state becomes `READY`. + * + *

The returned [long-running operation][google.longrunning.Operation] will have a name of the + * format `<instance_partition_name>/operations/<operation_id>` and can be used to + * track creation of the instance partition. The [metadata][google.longrunning.Operation.metadata] + * field type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   CreateInstancePartitionRequest request =
+   *       CreateInstancePartitionRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setInstancePartitionId("instancePartitionId1364450768")
+   *           .setInstancePartition(InstancePartition.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       instanceAdminClient.createInstancePartitionOperationCallable().futureCall(request);
+   *   // Do something.
+   *   InstancePartition response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable< + CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata> + createInstancePartitionOperationCallable() { + return stub.createInstancePartitionOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates an instance partition and begins preparing it to be used. The returned [long-running + * operation][google.longrunning.Operation] can be used to track the progress of preparing the new + * instance partition. The instance partition name is assigned by the caller. If the named + * instance partition already exists, `CreateInstancePartition` returns `ALREADY_EXISTS`. + * + *

Immediately upon completion of this request: + * + *

* The instance partition is readable via the API, with all requested attributes but no + * allocated resources. Its state is `CREATING`. + * + *

Until completion of the returned operation: + * + *

* Cancelling the operation renders the instance partition immediately unreadable via the + * API. * The instance partition can be deleted. * All other attempts to modify the + * instance partition are rejected. + * + *

Upon completion of the returned operation: + * + *

* Billing for all successfully-allocated resources begins (some types may have lower + * than the requested levels). * Databases can start using this instance partition. * The + * instance partition's allocated resource levels are readable via the API. * The instance + * partition's state becomes `READY`. + * + *

The returned [long-running operation][google.longrunning.Operation] will have a name of the + * format `<instance_partition_name>/operations/<operation_id>` and can be used to + * track creation of the instance partition. The [metadata][google.longrunning.Operation.metadata] + * field type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   CreateInstancePartitionRequest request =
+   *       CreateInstancePartitionRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setInstancePartitionId("instancePartitionId1364450768")
+   *           .setInstancePartition(InstancePartition.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       instanceAdminClient.createInstancePartitionCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + createInstancePartitionCallable() { + return stub.createInstancePartitionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an existing instance partition. Requires that the instance partition is not used by any + * database or backup and is not the default instance partition of an instance. + * + *

Authorization requires `spanner.instancePartitions.delete` permission on the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   InstancePartitionName name =
+   *       InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]");
+   *   instanceAdminClient.deleteInstancePartition(name);
+   * }
+   * }
+ * + * @param name Required. The name of the instance partition to be deleted. Values are of the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteInstancePartition(InstancePartitionName name) { + DeleteInstancePartitionRequest request = + DeleteInstancePartitionRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + deleteInstancePartition(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an existing instance partition. Requires that the instance partition is not used by any + * database or backup and is not the default instance partition of an instance. + * + *

Authorization requires `spanner.instancePartitions.delete` permission on the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   String name =
+   *       InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]").toString();
+   *   instanceAdminClient.deleteInstancePartition(name);
+   * }
+   * }
+ * + * @param name Required. The name of the instance partition to be deleted. Values are of the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteInstancePartition(String name) { + DeleteInstancePartitionRequest request = + DeleteInstancePartitionRequest.newBuilder().setName(name).build(); + deleteInstancePartition(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an existing instance partition. Requires that the instance partition is not used by any + * database or backup and is not the default instance partition of an instance. + * + *

Authorization requires `spanner.instancePartitions.delete` permission on the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   DeleteInstancePartitionRequest request =
+   *       DeleteInstancePartitionRequest.newBuilder()
+   *           .setName(
+   *               InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]")
+   *                   .toString())
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   instanceAdminClient.deleteInstancePartition(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteInstancePartition(DeleteInstancePartitionRequest request) { + deleteInstancePartitionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an existing instance partition. Requires that the instance partition is not used by any + * database or backup and is not the default instance partition of an instance. + * + *

Authorization requires `spanner.instancePartitions.delete` permission on the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   DeleteInstancePartitionRequest request =
+   *       DeleteInstancePartitionRequest.newBuilder()
+   *           .setName(
+   *               InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]")
+   *                   .toString())
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   ApiFuture future =
+   *       instanceAdminClient.deleteInstancePartitionCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + deleteInstancePartitionCallable() { + return stub.deleteInstancePartitionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an instance partition, and begins allocating or releasing resources as requested. The + * returned [long-running operation][google.longrunning.Operation] can be used to track the + * progress of updating the instance partition. If the named instance partition does not exist, + * returns `NOT_FOUND`. + * + *

Immediately upon completion of this request: + * + *

* For resource types for which a decrease in the instance partition's allocation has + * been requested, billing is based on the newly-requested level. + * + *

Until completion of the returned operation: + * + *

* Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], + * and begins restoring resources to their pre-request values. The operation is guaranteed to + * succeed at undoing all resource changes, after which point it terminates with a `CANCELLED` + * status. * All other attempts to modify the instance partition are rejected. * Reading + * the instance partition via the API continues to give the pre-request resource levels. + * + *

Upon completion of the returned operation: + * + *

* Billing begins for all successfully-allocated resources (some types may have lower + * than the requested levels). * All newly-reserved resources are available for serving the + * instance partition's tables. * The instance partition's new resource levels are readable + * via the API. + * + *

The returned [long-running operation][google.longrunning.Operation] will have a name of the + * format `<instance_partition_name>/operations/<operation_id>` and can be used to + * track the instance partition modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful. + * + *

Authorization requires `spanner.instancePartitions.update` permission on the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   InstancePartition instancePartition = InstancePartition.newBuilder().build();
+   *   FieldMask fieldMask = FieldMask.newBuilder().build();
+   *   InstancePartition response =
+   *       instanceAdminClient.updateInstancePartitionAsync(instancePartition, fieldMask).get();
+   * }
+   * }
+ * + * @param instancePartition Required. The instance partition to update, which must always include + * the instance partition name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] + * need be included. + * @param fieldMask Required. A mask specifying which fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] should be updated. + * The field mask must always be specified; this prevents any future fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] from being erased + * accidentally by clients that do not know about them. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture + updateInstancePartitionAsync(InstancePartition instancePartition, FieldMask fieldMask) { + UpdateInstancePartitionRequest request = + UpdateInstancePartitionRequest.newBuilder() + .setInstancePartition(instancePartition) + .setFieldMask(fieldMask) + .build(); + return updateInstancePartitionAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an instance partition, and begins allocating or releasing resources as requested. The + * returned [long-running operation][google.longrunning.Operation] can be used to track the + * progress of updating the instance partition. If the named instance partition does not exist, + * returns `NOT_FOUND`. + * + *

Immediately upon completion of this request: + * + *

* For resource types for which a decrease in the instance partition's allocation has + * been requested, billing is based on the newly-requested level. + * + *

Until completion of the returned operation: + * + *

* Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], + * and begins restoring resources to their pre-request values. The operation is guaranteed to + * succeed at undoing all resource changes, after which point it terminates with a `CANCELLED` + * status. * All other attempts to modify the instance partition are rejected. * Reading + * the instance partition via the API continues to give the pre-request resource levels. + * + *

Upon completion of the returned operation: + * + *

* Billing begins for all successfully-allocated resources (some types may have lower + * than the requested levels). * All newly-reserved resources are available for serving the + * instance partition's tables. * The instance partition's new resource levels are readable + * via the API. + * + *

The returned [long-running operation][google.longrunning.Operation] will have a name of the + * format `<instance_partition_name>/operations/<operation_id>` and can be used to + * track the instance partition modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful. + * + *

Authorization requires `spanner.instancePartitions.update` permission on the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   UpdateInstancePartitionRequest request =
+   *       UpdateInstancePartitionRequest.newBuilder()
+   *           .setInstancePartition(InstancePartition.newBuilder().build())
+   *           .setFieldMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   InstancePartition response = instanceAdminClient.updateInstancePartitionAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture + updateInstancePartitionAsync(UpdateInstancePartitionRequest request) { + return updateInstancePartitionOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an instance partition, and begins allocating or releasing resources as requested. The + * returned [long-running operation][google.longrunning.Operation] can be used to track the + * progress of updating the instance partition. If the named instance partition does not exist, + * returns `NOT_FOUND`. + * + *

Immediately upon completion of this request: + * + *

* For resource types for which a decrease in the instance partition's allocation has + * been requested, billing is based on the newly-requested level. + * + *

Until completion of the returned operation: + * + *

* Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], + * and begins restoring resources to their pre-request values. The operation is guaranteed to + * succeed at undoing all resource changes, after which point it terminates with a `CANCELLED` + * status. * All other attempts to modify the instance partition are rejected. * Reading + * the instance partition via the API continues to give the pre-request resource levels. + * + *

Upon completion of the returned operation: + * + *

* Billing begins for all successfully-allocated resources (some types may have lower + * than the requested levels). * All newly-reserved resources are available for serving the + * instance partition's tables. * The instance partition's new resource levels are readable + * via the API. + * + *

The returned [long-running operation][google.longrunning.Operation] will have a name of the + * format `<instance_partition_name>/operations/<operation_id>` and can be used to + * track the instance partition modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful. + * + *

Authorization requires `spanner.instancePartitions.update` permission on the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   UpdateInstancePartitionRequest request =
+   *       UpdateInstancePartitionRequest.newBuilder()
+   *           .setInstancePartition(InstancePartition.newBuilder().build())
+   *           .setFieldMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       instanceAdminClient.updateInstancePartitionOperationCallable().futureCall(request);
+   *   // Do something.
+   *   InstancePartition response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable< + UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata> + updateInstancePartitionOperationCallable() { + return stub.updateInstancePartitionOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an instance partition, and begins allocating or releasing resources as requested. The + * returned [long-running operation][google.longrunning.Operation] can be used to track the + * progress of updating the instance partition. If the named instance partition does not exist, + * returns `NOT_FOUND`. + * + *

Immediately upon completion of this request: + * + *

* For resource types for which a decrease in the instance partition's allocation has + * been requested, billing is based on the newly-requested level. + * + *

Until completion of the returned operation: + * + *

* Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], + * and begins restoring resources to their pre-request values. The operation is guaranteed to + * succeed at undoing all resource changes, after which point it terminates with a `CANCELLED` + * status. * All other attempts to modify the instance partition are rejected. * Reading + * the instance partition via the API continues to give the pre-request resource levels. + * + *

Upon completion of the returned operation: + * + *

* Billing begins for all successfully-allocated resources (some types may have lower + * than the requested levels). * All newly-reserved resources are available for serving the + * instance partition's tables. * The instance partition's new resource levels are readable + * via the API. + * + *

The returned [long-running operation][google.longrunning.Operation] will have a name of the + * format `<instance_partition_name>/operations/<operation_id>` and can be used to + * track the instance partition modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if successful. + * + *

Authorization requires `spanner.instancePartitions.update` permission on the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   UpdateInstancePartitionRequest request =
+   *       UpdateInstancePartitionRequest.newBuilder()
+   *           .setInstancePartition(InstancePartition.newBuilder().build())
+   *           .setFieldMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       instanceAdminClient.updateInstancePartitionCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + updateInstancePartitionCallable() { + return stub.updateInstancePartitionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists instance partition [long-running operations][google.longrunning.Operation] in the given + * instance. An instance partition operation has a name of the form + * `projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>`. + * The long-running operation [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned include those that + * have completed/failed/canceled within the last 7 days, and pending operations. Operations + * returned are ordered by `operation.metadata.value.start_time` in descending order starting from + * the most recently started operation. + * + *

Authorization requires `spanner.instancePartitionOperations.list` permission on the resource + * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+   *   for (Operation element :
+   *       instanceAdminClient.listInstancePartitionOperations(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The parent instance of the instance partition operations. Values are of + * the form `projects/<project>/instances/<instance>`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListInstancePartitionOperationsPagedResponse listInstancePartitionOperations( + InstanceName parent) { + ListInstancePartitionOperationsRequest request = + ListInstancePartitionOperationsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listInstancePartitionOperations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists instance partition [long-running operations][google.longrunning.Operation] in the given + * instance. An instance partition operation has a name of the form + * `projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>`. + * The long-running operation [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned include those that + * have completed/failed/canceled within the last 7 days, and pending operations. Operations + * returned are ordered by `operation.metadata.value.start_time` in descending order starting from + * the most recently started operation. + * + *

Authorization requires `spanner.instancePartitionOperations.list` permission on the resource + * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+   *   for (Operation element :
+   *       instanceAdminClient.listInstancePartitionOperations(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The parent instance of the instance partition operations. Values are of + * the form `projects/<project>/instances/<instance>`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListInstancePartitionOperationsPagedResponse listInstancePartitionOperations( + String parent) { + ListInstancePartitionOperationsRequest request = + ListInstancePartitionOperationsRequest.newBuilder().setParent(parent).build(); + return listInstancePartitionOperations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists instance partition [long-running operations][google.longrunning.Operation] in the given + * instance. An instance partition operation has a name of the form + * `projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>`. + * The long-running operation [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned include those that + * have completed/failed/canceled within the last 7 days, and pending operations. Operations + * returned are ordered by `operation.metadata.value.start_time` in descending order starting from + * the most recently started operation. + * + *

Authorization requires `spanner.instancePartitionOperations.list` permission on the resource + * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   ListInstancePartitionOperationsRequest request =
+   *       ListInstancePartitionOperationsRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setInstancePartitionDeadline(Timestamp.newBuilder().build())
+   *           .build();
+   *   for (Operation element :
+   *       instanceAdminClient.listInstancePartitionOperations(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListInstancePartitionOperationsPagedResponse listInstancePartitionOperations( + ListInstancePartitionOperationsRequest request) { + return listInstancePartitionOperationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists instance partition [long-running operations][google.longrunning.Operation] in the given + * instance. An instance partition operation has a name of the form + * `projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>`. + * The long-running operation [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned include those that + * have completed/failed/canceled within the last 7 days, and pending operations. Operations + * returned are ordered by `operation.metadata.value.start_time` in descending order starting from + * the most recently started operation. + * + *

Authorization requires `spanner.instancePartitionOperations.list` permission on the resource + * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   ListInstancePartitionOperationsRequest request =
+   *       ListInstancePartitionOperationsRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setInstancePartitionDeadline(Timestamp.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       instanceAdminClient.listInstancePartitionOperationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Operation element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsPagedResponse> + listInstancePartitionOperationsPagedCallable() { + return stub.listInstancePartitionOperationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists instance partition [long-running operations][google.longrunning.Operation] in the given + * instance. An instance partition operation has a name of the form + * `projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>`. + * The long-running operation [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned include those that + * have completed/failed/canceled within the last 7 days, and pending operations. Operations + * returned are ordered by `operation.metadata.value.start_time` in descending order starting from + * the most recently started operation. + * + *

Authorization requires `spanner.instancePartitionOperations.list` permission on the resource + * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
+   *   ListInstancePartitionOperationsRequest request =
+   *       ListInstancePartitionOperationsRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setInstancePartitionDeadline(Timestamp.newBuilder().build())
+   *           .build();
+   *   while (true) {
+   *     ListInstancePartitionOperationsResponse response =
+   *         instanceAdminClient.listInstancePartitionOperationsCallable().call(request);
+   *     for (Operation element : response.getOperationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse> + listInstancePartitionOperationsCallable() { + return stub.listInstancePartitionOperationsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); } @Override @@ -3513,4 +4928,189 @@ protected ListInstancesFixedSizeCollection createCollection( return new ListInstancesFixedSizeCollection(pages, collectionSize); } } + + public static class ListInstancePartitionsPagedResponse + extends AbstractPagedListResponse< + ListInstancePartitionsRequest, + ListInstancePartitionsResponse, + InstancePartition, + ListInstancePartitionsPage, + ListInstancePartitionsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + ListInstancePartitionsRequest, ListInstancePartitionsResponse, InstancePartition> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListInstancePartitionsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListInstancePartitionsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListInstancePartitionsPagedResponse(ListInstancePartitionsPage page) { + super(page, ListInstancePartitionsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListInstancePartitionsPage + extends AbstractPage< + ListInstancePartitionsRequest, + ListInstancePartitionsResponse, + InstancePartition, + ListInstancePartitionsPage> { + + private ListInstancePartitionsPage( + PageContext< + ListInstancePartitionsRequest, ListInstancePartitionsResponse, InstancePartition> + context, + ListInstancePartitionsResponse response) { + super(context, response); + } + + private static ListInstancePartitionsPage createEmptyPage() { + return new ListInstancePartitionsPage(null, null); + } + + @Override + protected ListInstancePartitionsPage createPage( + PageContext< + ListInstancePartitionsRequest, ListInstancePartitionsResponse, InstancePartition> + context, + ListInstancePartitionsResponse response) { + return new ListInstancePartitionsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + ListInstancePartitionsRequest, ListInstancePartitionsResponse, InstancePartition> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListInstancePartitionsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListInstancePartitionsRequest, + ListInstancePartitionsResponse, + InstancePartition, + ListInstancePartitionsPage, + ListInstancePartitionsFixedSizeCollection> { + + private ListInstancePartitionsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListInstancePartitionsFixedSizeCollection createEmptyCollection() { + return new ListInstancePartitionsFixedSizeCollection(null, 0); + } + + @Override + protected ListInstancePartitionsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListInstancePartitionsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListInstancePartitionOperationsPagedResponse + extends AbstractPagedListResponse< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + Operation, + ListInstancePartitionOperationsPage, + ListInstancePartitionOperationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + Operation> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListInstancePartitionOperationsPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListInstancePartitionOperationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListInstancePartitionOperationsPagedResponse(ListInstancePartitionOperationsPage page) { + super(page, ListInstancePartitionOperationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListInstancePartitionOperationsPage + extends AbstractPage< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + Operation, + ListInstancePartitionOperationsPage> { + + private ListInstancePartitionOperationsPage( + PageContext< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + Operation> + context, + ListInstancePartitionOperationsResponse response) { + super(context, response); + } + + private static ListInstancePartitionOperationsPage createEmptyPage() { + return new ListInstancePartitionOperationsPage(null, null); + } + + @Override + protected ListInstancePartitionOperationsPage createPage( + PageContext< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + Operation> + context, + ListInstancePartitionOperationsResponse response) { + return new ListInstancePartitionOperationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + Operation> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListInstancePartitionOperationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + Operation, + ListInstancePartitionOperationsPage, + ListInstancePartitionOperationsFixedSizeCollection> { + + private ListInstancePartitionOperationsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListInstancePartitionOperationsFixedSizeCollection createEmptyCollection() { + return new ListInstancePartitionOperationsFixedSizeCollection(null, 0); + } + + @Override + protected ListInstancePartitionOperationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListInstancePartitionOperationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminSettings.java index 47b98450c25..cad1b2d7e9c 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminSettings.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminSettings.java @@ -18,6 +18,8 @@ import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigOperationsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionOperationsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancesPagedResponse; import com.google.api.core.ApiFunction; @@ -44,22 +46,33 @@ import com.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata; import com.google.spanner.admin.instance.v1.CreateInstanceConfigRequest; import com.google.spanner.admin.instance.v1.CreateInstanceMetadata; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.CreateInstanceRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceRequest; import com.google.spanner.admin.instance.v1.GetInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.GetInstancePartitionRequest; import com.google.spanner.admin.instance.v1.GetInstanceRequest; import com.google.spanner.admin.instance.v1.Instance; import com.google.spanner.admin.instance.v1.InstanceConfig; +import com.google.spanner.admin.instance.v1.InstancePartition; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse; import com.google.spanner.admin.instance.v1.ListInstanceConfigsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse; import com.google.spanner.admin.instance.v1.ListInstancesRequest; import com.google.spanner.admin.instance.v1.ListInstancesResponse; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceMetadata; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceRequest; import java.io.IOException; import java.util.List; @@ -160,6 +173,15 @@ public UnaryCallSettings deleteInstanceConfi return ((InstanceAdminStubSettings) getStubSettings()).listInstancesSettings(); } + /** Returns the object with the settings used for calls to listInstancePartitions. */ + public PagedCallSettings< + ListInstancePartitionsRequest, + ListInstancePartitionsResponse, + ListInstancePartitionsPagedResponse> + listInstancePartitionsSettings() { + return ((InstanceAdminStubSettings) getStubSettings()).listInstancePartitionsSettings(); + } + /** Returns the object with the settings used for calls to getInstance. */ public UnaryCallSettings getInstanceSettings() { return ((InstanceAdminStubSettings) getStubSettings()).getInstanceSettings(); @@ -208,6 +230,56 @@ public UnaryCallSettings getIamPolicySettings() { return ((InstanceAdminStubSettings) getStubSettings()).testIamPermissionsSettings(); } + /** Returns the object with the settings used for calls to getInstancePartition. */ + public UnaryCallSettings + getInstancePartitionSettings() { + return ((InstanceAdminStubSettings) getStubSettings()).getInstancePartitionSettings(); + } + + /** Returns the object with the settings used for calls to createInstancePartition. */ + public UnaryCallSettings + createInstancePartitionSettings() { + return ((InstanceAdminStubSettings) getStubSettings()).createInstancePartitionSettings(); + } + + /** Returns the object with the settings used for calls to createInstancePartition. */ + public OperationCallSettings< + CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata> + createInstancePartitionOperationSettings() { + return ((InstanceAdminStubSettings) getStubSettings()) + .createInstancePartitionOperationSettings(); + } + + /** Returns the object with the settings used for calls to deleteInstancePartition. */ + public UnaryCallSettings + deleteInstancePartitionSettings() { + return ((InstanceAdminStubSettings) getStubSettings()).deleteInstancePartitionSettings(); + } + + /** Returns the object with the settings used for calls to updateInstancePartition. */ + public UnaryCallSettings + updateInstancePartitionSettings() { + return ((InstanceAdminStubSettings) getStubSettings()).updateInstancePartitionSettings(); + } + + /** Returns the object with the settings used for calls to updateInstancePartition. */ + public OperationCallSettings< + UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata> + updateInstancePartitionOperationSettings() { + return ((InstanceAdminStubSettings) getStubSettings()) + .updateInstancePartitionOperationSettings(); + } + + /** Returns the object with the settings used for calls to listInstancePartitionOperations. */ + public PagedCallSettings< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + ListInstancePartitionOperationsPagedResponse> + listInstancePartitionOperationsSettings() { + return ((InstanceAdminStubSettings) getStubSettings()) + .listInstancePartitionOperationsSettings(); + } + public static final InstanceAdminSettings create(InstanceAdminStubSettings stub) throws IOException { return new InstanceAdminSettings.Builder(stub.toBuilder()).build(); @@ -259,7 +331,6 @@ public static Builder newBuilder() { } /** Returns a new REST builder for this class. */ - @BetaApi public static Builder newHttpJsonBuilder() { return Builder.createHttpJsonDefault(); } @@ -301,7 +372,6 @@ private static Builder createDefault() { return new Builder(InstanceAdminStubSettings.newBuilder()); } - @BetaApi private static Builder createHttpJsonDefault() { return new Builder(InstanceAdminStubSettings.newHttpJsonBuilder()); } @@ -385,6 +455,15 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().listInstancesSettings(); } + /** Returns the builder for the settings used for calls to listInstancePartitions. */ + public PagedCallSettings.Builder< + ListInstancePartitionsRequest, + ListInstancePartitionsResponse, + ListInstancePartitionsPagedResponse> + listInstancePartitionsSettings() { + return getStubSettingsBuilder().listInstancePartitionsSettings(); + } + /** Returns the builder for the settings used for calls to getInstance. */ public UnaryCallSettings.Builder getInstanceSettings() { return getStubSettingsBuilder().getInstanceSettings(); @@ -433,6 +512,53 @@ public UnaryCallSettings.Builder getIamPolicySettin return getStubSettingsBuilder().testIamPermissionsSettings(); } + /** Returns the builder for the settings used for calls to getInstancePartition. */ + public UnaryCallSettings.Builder + getInstancePartitionSettings() { + return getStubSettingsBuilder().getInstancePartitionSettings(); + } + + /** Returns the builder for the settings used for calls to createInstancePartition. */ + public UnaryCallSettings.Builder + createInstancePartitionSettings() { + return getStubSettingsBuilder().createInstancePartitionSettings(); + } + + /** Returns the builder for the settings used for calls to createInstancePartition. */ + public OperationCallSettings.Builder< + CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata> + createInstancePartitionOperationSettings() { + return getStubSettingsBuilder().createInstancePartitionOperationSettings(); + } + + /** Returns the builder for the settings used for calls to deleteInstancePartition. */ + public UnaryCallSettings.Builder + deleteInstancePartitionSettings() { + return getStubSettingsBuilder().deleteInstancePartitionSettings(); + } + + /** Returns the builder for the settings used for calls to updateInstancePartition. */ + public UnaryCallSettings.Builder + updateInstancePartitionSettings() { + return getStubSettingsBuilder().updateInstancePartitionSettings(); + } + + /** Returns the builder for the settings used for calls to updateInstancePartition. */ + public OperationCallSettings.Builder< + UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata> + updateInstancePartitionOperationSettings() { + return getStubSettingsBuilder().updateInstancePartitionOperationSettings(); + } + + /** Returns the builder for the settings used for calls to listInstancePartitionOperations. */ + public PagedCallSettings.Builder< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + ListInstancePartitionOperationsPagedResponse> + listInstancePartitionOperationsSettings() { + return getStubSettingsBuilder().listInstancePartitionOperationsSettings(); + } + @Override public InstanceAdminSettings build() throws IOException { return new InstanceAdminSettings(this); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/gapic_metadata.json b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/gapic_metadata.json index 2296749c13a..594176d4e7d 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/gapic_metadata.json +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/gapic_metadata.json @@ -16,12 +16,18 @@ "CreateInstanceConfig": { "methods": ["createInstanceConfigAsync", "createInstanceConfigAsync", "createInstanceConfigAsync", "createInstanceConfigOperationCallable", "createInstanceConfigCallable"] }, + "CreateInstancePartition": { + "methods": ["createInstancePartitionAsync", "createInstancePartitionAsync", "createInstancePartitionAsync", "createInstancePartitionOperationCallable", "createInstancePartitionCallable"] + }, "DeleteInstance": { "methods": ["deleteInstance", "deleteInstance", "deleteInstance", "deleteInstanceCallable"] }, "DeleteInstanceConfig": { "methods": ["deleteInstanceConfig", "deleteInstanceConfig", "deleteInstanceConfig", "deleteInstanceConfigCallable"] }, + "DeleteInstancePartition": { + "methods": ["deleteInstancePartition", "deleteInstancePartition", "deleteInstancePartition", "deleteInstancePartitionCallable"] + }, "GetIamPolicy": { "methods": ["getIamPolicy", "getIamPolicy", "getIamPolicy", "getIamPolicyCallable"] }, @@ -31,12 +37,21 @@ "GetInstanceConfig": { "methods": ["getInstanceConfig", "getInstanceConfig", "getInstanceConfig", "getInstanceConfigCallable"] }, + "GetInstancePartition": { + "methods": ["getInstancePartition", "getInstancePartition", "getInstancePartition", "getInstancePartitionCallable"] + }, "ListInstanceConfigOperations": { "methods": ["listInstanceConfigOperations", "listInstanceConfigOperations", "listInstanceConfigOperations", "listInstanceConfigOperationsPagedCallable", "listInstanceConfigOperationsCallable"] }, "ListInstanceConfigs": { "methods": ["listInstanceConfigs", "listInstanceConfigs", "listInstanceConfigs", "listInstanceConfigsPagedCallable", "listInstanceConfigsCallable"] }, + "ListInstancePartitionOperations": { + "methods": ["listInstancePartitionOperations", "listInstancePartitionOperations", "listInstancePartitionOperations", "listInstancePartitionOperationsPagedCallable", "listInstancePartitionOperationsCallable"] + }, + "ListInstancePartitions": { + "methods": ["listInstancePartitions", "listInstancePartitions", "listInstancePartitions", "listInstancePartitionsPagedCallable", "listInstancePartitionsCallable"] + }, "ListInstances": { "methods": ["listInstances", "listInstances", "listInstances", "listInstancesPagedCallable", "listInstancesCallable"] }, @@ -51,6 +66,9 @@ }, "UpdateInstanceConfig": { "methods": ["updateInstanceConfigAsync", "updateInstanceConfigAsync", "updateInstanceConfigOperationCallable", "updateInstanceConfigCallable"] + }, + "UpdateInstancePartition": { + "methods": ["updateInstancePartitionAsync", "updateInstancePartitionAsync", "updateInstancePartitionOperationCallable", "updateInstancePartitionCallable"] } } } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/GrpcInstanceAdminStub.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/GrpcInstanceAdminStub.java index 5a34809109a..3369a1642b6 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/GrpcInstanceAdminStub.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/GrpcInstanceAdminStub.java @@ -18,6 +18,8 @@ import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigOperationsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionOperationsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancesPagedResponse; import com.google.api.gax.core.BackgroundResource; @@ -39,22 +41,33 @@ import com.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata; import com.google.spanner.admin.instance.v1.CreateInstanceConfigRequest; import com.google.spanner.admin.instance.v1.CreateInstanceMetadata; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.CreateInstanceRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceRequest; import com.google.spanner.admin.instance.v1.GetInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.GetInstancePartitionRequest; import com.google.spanner.admin.instance.v1.GetInstanceRequest; import com.google.spanner.admin.instance.v1.Instance; import com.google.spanner.admin.instance.v1.InstanceConfig; +import com.google.spanner.admin.instance.v1.InstancePartition; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse; import com.google.spanner.admin.instance.v1.ListInstanceConfigsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse; import com.google.spanner.admin.instance.v1.ListInstancesRequest; import com.google.spanner.admin.instance.v1.ListInstancesResponse; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceMetadata; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceRequest; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -151,6 +164,20 @@ public class GrpcInstanceAdminStub extends InstanceAdminStub { ProtoUtils.marshaller(ListInstancesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor< + ListInstancePartitionsRequest, ListInstancePartitionsResponse> + listInstancePartitionsMethodDescriptor = + MethodDescriptor + .newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitions") + .setRequestMarshaller( + ProtoUtils.marshaller(ListInstancePartitionsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListInstancePartitionsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor getInstanceMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -217,6 +244,67 @@ public class GrpcInstanceAdminStub extends InstanceAdminStub { ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor + getInstancePartitionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.spanner.admin.instance.v1.InstanceAdmin/GetInstancePartition") + .setRequestMarshaller( + ProtoUtils.marshaller(GetInstancePartitionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(InstancePartition.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + createInstancePartitionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.spanner.admin.instance.v1.InstanceAdmin/CreateInstancePartition") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateInstancePartitionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + deleteInstancePartitionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstancePartition") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteInstancePartitionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateInstancePartitionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstancePartition") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateInstancePartitionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse> + listInstancePartitionOperationsMethodDescriptor = + MethodDescriptor + . + newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitionOperations") + .setRequestMarshaller( + ProtoUtils.marshaller( + ListInstancePartitionOperationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller( + ListInstancePartitionOperationsResponse.getDefaultInstance())) + .build(); + private final UnaryCallable listInstanceConfigsCallable; private final UnaryCallable @@ -240,6 +328,10 @@ public class GrpcInstanceAdminStub extends InstanceAdminStub { private final UnaryCallable listInstancesCallable; private final UnaryCallable listInstancesPagedCallable; + private final UnaryCallable + listInstancePartitionsCallable; + private final UnaryCallable + listInstancePartitionsPagedCallable; private final UnaryCallable getInstanceCallable; private final UnaryCallable createInstanceCallable; private final OperationCallable @@ -252,6 +344,26 @@ public class GrpcInstanceAdminStub extends InstanceAdminStub { private final UnaryCallable getIamPolicyCallable; private final UnaryCallable testIamPermissionsCallable; + private final UnaryCallable + getInstancePartitionCallable; + private final UnaryCallable + createInstancePartitionCallable; + private final OperationCallable< + CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata> + createInstancePartitionOperationCallable; + private final UnaryCallable + deleteInstancePartitionCallable; + private final UnaryCallable + updateInstancePartitionCallable; + private final OperationCallable< + UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata> + updateInstancePartitionOperationCallable; + private final UnaryCallable< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse> + listInstancePartitionOperationsCallable; + private final UnaryCallable< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsPagedResponse> + listInstancePartitionOperationsPagedCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -371,6 +483,18 @@ protected GrpcInstanceAdminStub( return builder.build(); }) .build(); + GrpcCallSettings + listInstancePartitionsTransportSettings = + GrpcCallSettings + .newBuilder() + .setMethodDescriptor(listInstancePartitionsMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .build(); GrpcCallSettings getInstanceTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getInstanceMethodDescriptor) @@ -442,6 +566,66 @@ protected GrpcInstanceAdminStub( return builder.build(); }) .build(); + GrpcCallSettings + getInstancePartitionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getInstancePartitionMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); + GrpcCallSettings + createInstancePartitionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createInstancePartitionMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .build(); + GrpcCallSettings + deleteInstancePartitionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteInstancePartitionMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); + GrpcCallSettings + updateInstancePartitionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateInstancePartitionMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add( + "instance_partition.name", + String.valueOf(request.getInstancePartition().getName())); + return builder.build(); + }) + .build(); + GrpcCallSettings< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse> + listInstancePartitionOperationsTransportSettings = + GrpcCallSettings + . + newBuilder() + .setMethodDescriptor(listInstancePartitionOperationsMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .build(); this.listInstanceConfigsCallable = callableFactory.createUnaryCallable( @@ -501,6 +685,16 @@ protected GrpcInstanceAdminStub( this.listInstancesPagedCallable = callableFactory.createPagedCallable( listInstancesTransportSettings, settings.listInstancesSettings(), clientContext); + this.listInstancePartitionsCallable = + callableFactory.createUnaryCallable( + listInstancePartitionsTransportSettings, + settings.listInstancePartitionsSettings(), + clientContext); + this.listInstancePartitionsPagedCallable = + callableFactory.createPagedCallable( + listInstancePartitionsTransportSettings, + settings.listInstancePartitionsSettings(), + clientContext); this.getInstanceCallable = callableFactory.createUnaryCallable( getInstanceTransportSettings, settings.getInstanceSettings(), clientContext); @@ -536,6 +730,48 @@ protected GrpcInstanceAdminStub( testIamPermissionsTransportSettings, settings.testIamPermissionsSettings(), clientContext); + this.getInstancePartitionCallable = + callableFactory.createUnaryCallable( + getInstancePartitionTransportSettings, + settings.getInstancePartitionSettings(), + clientContext); + this.createInstancePartitionCallable = + callableFactory.createUnaryCallable( + createInstancePartitionTransportSettings, + settings.createInstancePartitionSettings(), + clientContext); + this.createInstancePartitionOperationCallable = + callableFactory.createOperationCallable( + createInstancePartitionTransportSettings, + settings.createInstancePartitionOperationSettings(), + clientContext, + operationsStub); + this.deleteInstancePartitionCallable = + callableFactory.createUnaryCallable( + deleteInstancePartitionTransportSettings, + settings.deleteInstancePartitionSettings(), + clientContext); + this.updateInstancePartitionCallable = + callableFactory.createUnaryCallable( + updateInstancePartitionTransportSettings, + settings.updateInstancePartitionSettings(), + clientContext); + this.updateInstancePartitionOperationCallable = + callableFactory.createOperationCallable( + updateInstancePartitionTransportSettings, + settings.updateInstancePartitionOperationSettings(), + clientContext, + operationsStub); + this.listInstancePartitionOperationsCallable = + callableFactory.createUnaryCallable( + listInstancePartitionOperationsTransportSettings, + settings.listInstancePartitionOperationsSettings(), + clientContext); + this.listInstancePartitionOperationsPagedCallable = + callableFactory.createPagedCallable( + listInstancePartitionOperationsTransportSettings, + settings.listInstancePartitionOperationsSettings(), + clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -615,6 +851,18 @@ public UnaryCallable listInstancesC return listInstancesPagedCallable; } + @Override + public UnaryCallable + listInstancePartitionsCallable() { + return listInstancePartitionsCallable; + } + + @Override + public UnaryCallable + listInstancePartitionsPagedCallable() { + return listInstancePartitionsPagedCallable; + } + @Override public UnaryCallable getInstanceCallable() { return getInstanceCallable; @@ -663,6 +911,57 @@ public UnaryCallable getIamPolicyCallable() { return testIamPermissionsCallable; } + @Override + public UnaryCallable + getInstancePartitionCallable() { + return getInstancePartitionCallable; + } + + @Override + public UnaryCallable + createInstancePartitionCallable() { + return createInstancePartitionCallable; + } + + @Override + public OperationCallable< + CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata> + createInstancePartitionOperationCallable() { + return createInstancePartitionOperationCallable; + } + + @Override + public UnaryCallable deleteInstancePartitionCallable() { + return deleteInstancePartitionCallable; + } + + @Override + public UnaryCallable + updateInstancePartitionCallable() { + return updateInstancePartitionCallable; + } + + @Override + public OperationCallable< + UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata> + updateInstancePartitionOperationCallable() { + return updateInstancePartitionOperationCallable; + } + + @Override + public UnaryCallable< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse> + listInstancePartitionOperationsCallable() { + return listInstancePartitionOperationsCallable; + } + + @Override + public UnaryCallable< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsPagedResponse> + listInstancePartitionOperationsPagedCallable() { + return listInstancePartitionOperationsPagedCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/HttpJsonInstanceAdminCallableFactory.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/HttpJsonInstanceAdminCallableFactory.java index 8858b882160..7aec0755e63 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/HttpJsonInstanceAdminCallableFactory.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/HttpJsonInstanceAdminCallableFactory.java @@ -16,7 +16,6 @@ package com.google.cloud.spanner.admin.instance.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.httpjson.HttpJsonCallSettings; import com.google.api.gax.httpjson.HttpJsonCallableFactory; import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; @@ -41,7 +40,6 @@ *

This class is for advanced usage. */ @Generated("by gapic-generator-java") -@BetaApi public class HttpJsonInstanceAdminCallableFactory implements HttpJsonStubCallableFactory { @@ -73,8 +71,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/HttpJsonInstanceAdminStub.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/HttpJsonInstanceAdminStub.java index 47d4c7108c7..9e530b899e0 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/HttpJsonInstanceAdminStub.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/HttpJsonInstanceAdminStub.java @@ -18,10 +18,11 @@ import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigOperationsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionOperationsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancesPagedResponse; import com.google.api.HttpRule; -import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -49,22 +50,33 @@ import com.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata; import com.google.spanner.admin.instance.v1.CreateInstanceConfigRequest; import com.google.spanner.admin.instance.v1.CreateInstanceMetadata; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.CreateInstanceRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceRequest; import com.google.spanner.admin.instance.v1.GetInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.GetInstancePartitionRequest; import com.google.spanner.admin.instance.v1.GetInstanceRequest; import com.google.spanner.admin.instance.v1.Instance; import com.google.spanner.admin.instance.v1.InstanceConfig; +import com.google.spanner.admin.instance.v1.InstancePartition; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse; import com.google.spanner.admin.instance.v1.ListInstanceConfigsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse; import com.google.spanner.admin.instance.v1.ListInstancesRequest; import com.google.spanner.admin.instance.v1.ListInstancesResponse; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceMetadata; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceRequest; import java.io.IOException; import java.util.ArrayList; @@ -81,12 +93,14 @@ *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator-java") -@BetaApi public class HttpJsonInstanceAdminStub extends InstanceAdminStub { private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder() .add(InstanceConfig.getDescriptor()) + .add(CreateInstancePartitionMetadata.getDescriptor()) + .add(UpdateInstancePartitionMetadata.getDescriptor()) .add(Instance.getDescriptor()) + .add(InstancePartition.getDescriptor()) .add(CreateInstanceConfigMetadata.getDescriptor()) .add(UpdateInstanceMetadata.getDescriptor()) .add(CreateInstanceMetadata.getDescriptor()) @@ -351,6 +365,8 @@ public class HttpJsonInstanceAdminStub extends InstanceAdminStub { ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam( + fields, "instanceDeadline", request.getInstanceDeadline()); serializer.putQueryParam(fields, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); @@ -365,6 +381,49 @@ public class HttpJsonInstanceAdminStub extends InstanceAdminStub { .build()) .build(); + private static final ApiMethodDescriptor< + ListInstancePartitionsRequest, ListInstancePartitionsResponse> + listInstancePartitionsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitions") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/instances/*}/instancePartitions", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, + "instancePartitionDeadline", + request.getInstancePartitionDeadline()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListInstancePartitionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private static final ApiMethodDescriptor getInstanceMethodDescriptor = ApiMethodDescriptor.newBuilder() @@ -627,6 +686,208 @@ public class HttpJsonInstanceAdminStub extends InstanceAdminStub { .build()) .build(); + private static final ApiMethodDescriptor + getInstancePartitionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.spanner.admin.instance.v1.InstanceAdmin/GetInstancePartition") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/instances/*/instancePartitions/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(InstancePartition.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createInstancePartitionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.spanner.admin.instance.v1.InstanceAdmin/CreateInstancePartition") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/instances/*}/instancePartitions", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateInstancePartitionRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteInstancePartitionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstancePartition") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/instances/*/instancePartitions/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "etag", request.getEtag()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateInstancePartitionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstancePartition") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{instancePartition.name=projects/*/instances/*/instancePartitions/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "instancePartition.name", + request.getInstancePartition().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateInstancePartitionRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse> + listInstancePartitionOperationsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitionOperations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/instances/*}/instancePartitionOperations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam( + fields, + "instancePartitionDeadline", + request.getInstancePartitionDeadline()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance( + ListInstancePartitionOperationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listInstanceConfigsCallable; private final UnaryCallable @@ -650,6 +911,10 @@ public class HttpJsonInstanceAdminStub extends InstanceAdminStub { private final UnaryCallable listInstancesCallable; private final UnaryCallable listInstancesPagedCallable; + private final UnaryCallable + listInstancePartitionsCallable; + private final UnaryCallable + listInstancePartitionsPagedCallable; private final UnaryCallable getInstanceCallable; private final UnaryCallable createInstanceCallable; private final OperationCallable @@ -662,6 +927,26 @@ public class HttpJsonInstanceAdminStub extends InstanceAdminStub { private final UnaryCallable getIamPolicyCallable; private final UnaryCallable testIamPermissionsCallable; + private final UnaryCallable + getInstancePartitionCallable; + private final UnaryCallable + createInstancePartitionCallable; + private final OperationCallable< + CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata> + createInstancePartitionOperationCallable; + private final UnaryCallable + deleteInstancePartitionCallable; + private final UnaryCallable + updateInstancePartitionCallable; + private final OperationCallable< + UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata> + updateInstancePartitionOperationCallable; + private final UnaryCallable< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse> + listInstancePartitionOperationsCallable; + private final UnaryCallable< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsPagedResponse> + listInstancePartitionOperationsPagedCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -838,6 +1123,19 @@ protected HttpJsonInstanceAdminStub( return builder.build(); }) .build(); + HttpJsonCallSettings + listInstancePartitionsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listInstancePartitionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .build(); HttpJsonCallSettings getInstanceTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getInstanceMethodDescriptor) @@ -916,6 +1214,71 @@ protected HttpJsonInstanceAdminStub( return builder.build(); }) .build(); + HttpJsonCallSettings + getInstancePartitionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getInstancePartitionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); + HttpJsonCallSettings + createInstancePartitionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createInstancePartitionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .build(); + HttpJsonCallSettings + deleteInstancePartitionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteInstancePartitionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); + HttpJsonCallSettings + updateInstancePartitionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateInstancePartitionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add( + "instance_partition.name", + String.valueOf(request.getInstancePartition().getName())); + return builder.build(); + }) + .build(); + HttpJsonCallSettings< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse> + listInstancePartitionOperationsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listInstancePartitionOperationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .build(); this.listInstanceConfigsCallable = callableFactory.createUnaryCallable( @@ -975,6 +1338,16 @@ protected HttpJsonInstanceAdminStub( this.listInstancesPagedCallable = callableFactory.createPagedCallable( listInstancesTransportSettings, settings.listInstancesSettings(), clientContext); + this.listInstancePartitionsCallable = + callableFactory.createUnaryCallable( + listInstancePartitionsTransportSettings, + settings.listInstancePartitionsSettings(), + clientContext); + this.listInstancePartitionsPagedCallable = + callableFactory.createPagedCallable( + listInstancePartitionsTransportSettings, + settings.listInstancePartitionsSettings(), + clientContext); this.getInstanceCallable = callableFactory.createUnaryCallable( getInstanceTransportSettings, settings.getInstanceSettings(), clientContext); @@ -1010,6 +1383,48 @@ protected HttpJsonInstanceAdminStub( testIamPermissionsTransportSettings, settings.testIamPermissionsSettings(), clientContext); + this.getInstancePartitionCallable = + callableFactory.createUnaryCallable( + getInstancePartitionTransportSettings, + settings.getInstancePartitionSettings(), + clientContext); + this.createInstancePartitionCallable = + callableFactory.createUnaryCallable( + createInstancePartitionTransportSettings, + settings.createInstancePartitionSettings(), + clientContext); + this.createInstancePartitionOperationCallable = + callableFactory.createOperationCallable( + createInstancePartitionTransportSettings, + settings.createInstancePartitionOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteInstancePartitionCallable = + callableFactory.createUnaryCallable( + deleteInstancePartitionTransportSettings, + settings.deleteInstancePartitionSettings(), + clientContext); + this.updateInstancePartitionCallable = + callableFactory.createUnaryCallable( + updateInstancePartitionTransportSettings, + settings.updateInstancePartitionSettings(), + clientContext); + this.updateInstancePartitionOperationCallable = + callableFactory.createOperationCallable( + updateInstancePartitionTransportSettings, + settings.updateInstancePartitionOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listInstancePartitionOperationsCallable = + callableFactory.createUnaryCallable( + listInstancePartitionOperationsTransportSettings, + settings.listInstancePartitionOperationsSettings(), + clientContext); + this.listInstancePartitionOperationsPagedCallable = + callableFactory.createPagedCallable( + listInstancePartitionOperationsTransportSettings, + settings.listInstancePartitionOperationsSettings(), + clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -1025,6 +1440,7 @@ public static List getMethodDescriptors() { methodDescriptors.add(deleteInstanceConfigMethodDescriptor); methodDescriptors.add(listInstanceConfigOperationsMethodDescriptor); methodDescriptors.add(listInstancesMethodDescriptor); + methodDescriptors.add(listInstancePartitionsMethodDescriptor); methodDescriptors.add(getInstanceMethodDescriptor); methodDescriptors.add(createInstanceMethodDescriptor); methodDescriptors.add(updateInstanceMethodDescriptor); @@ -1032,6 +1448,11 @@ public static List getMethodDescriptors() { methodDescriptors.add(setIamPolicyMethodDescriptor); methodDescriptors.add(getIamPolicyMethodDescriptor); methodDescriptors.add(testIamPermissionsMethodDescriptor); + methodDescriptors.add(getInstancePartitionMethodDescriptor); + methodDescriptors.add(createInstancePartitionMethodDescriptor); + methodDescriptors.add(deleteInstancePartitionMethodDescriptor); + methodDescriptors.add(updateInstancePartitionMethodDescriptor); + methodDescriptors.add(listInstancePartitionOperationsMethodDescriptor); return methodDescriptors; } @@ -1109,6 +1530,18 @@ public UnaryCallable listInstancesC return listInstancesPagedCallable; } + @Override + public UnaryCallable + listInstancePartitionsCallable() { + return listInstancePartitionsCallable; + } + + @Override + public UnaryCallable + listInstancePartitionsPagedCallable() { + return listInstancePartitionsPagedCallable; + } + @Override public UnaryCallable getInstanceCallable() { return getInstanceCallable; @@ -1157,6 +1590,57 @@ public UnaryCallable getIamPolicyCallable() { return testIamPermissionsCallable; } + @Override + public UnaryCallable + getInstancePartitionCallable() { + return getInstancePartitionCallable; + } + + @Override + public UnaryCallable + createInstancePartitionCallable() { + return createInstancePartitionCallable; + } + + @Override + public OperationCallable< + CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata> + createInstancePartitionOperationCallable() { + return createInstancePartitionOperationCallable; + } + + @Override + public UnaryCallable deleteInstancePartitionCallable() { + return deleteInstancePartitionCallable; + } + + @Override + public UnaryCallable + updateInstancePartitionCallable() { + return updateInstancePartitionCallable; + } + + @Override + public OperationCallable< + UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata> + updateInstancePartitionOperationCallable() { + return updateInstancePartitionOperationCallable; + } + + @Override + public UnaryCallable< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse> + listInstancePartitionOperationsCallable() { + return listInstancePartitionOperationsCallable; + } + + @Override + public UnaryCallable< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsPagedResponse> + listInstancePartitionOperationsPagedCallable() { + return listInstancePartitionOperationsPagedCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/InstanceAdminStub.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/InstanceAdminStub.java index f9929401a68..31d266a67ef 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/InstanceAdminStub.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/InstanceAdminStub.java @@ -18,6 +18,8 @@ import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigOperationsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionOperationsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancesPagedResponse; import com.google.api.gax.core.BackgroundResource; @@ -34,22 +36,33 @@ import com.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata; import com.google.spanner.admin.instance.v1.CreateInstanceConfigRequest; import com.google.spanner.admin.instance.v1.CreateInstanceMetadata; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.CreateInstanceRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceRequest; import com.google.spanner.admin.instance.v1.GetInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.GetInstancePartitionRequest; import com.google.spanner.admin.instance.v1.GetInstanceRequest; import com.google.spanner.admin.instance.v1.Instance; import com.google.spanner.admin.instance.v1.InstanceConfig; +import com.google.spanner.admin.instance.v1.InstancePartition; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse; import com.google.spanner.admin.instance.v1.ListInstanceConfigsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse; import com.google.spanner.admin.instance.v1.ListInstancesRequest; import com.google.spanner.admin.instance.v1.ListInstancesResponse; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceMetadata; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceRequest; import javax.annotation.Generated; @@ -132,6 +145,17 @@ public UnaryCallable listInstancesC throw new UnsupportedOperationException("Not implemented: listInstancesCallable()"); } + public UnaryCallable + listInstancePartitionsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listInstancePartitionsPagedCallable()"); + } + + public UnaryCallable + listInstancePartitionsCallable() { + throw new UnsupportedOperationException("Not implemented: listInstancePartitionsCallable()"); + } + public UnaryCallable getInstanceCallable() { throw new UnsupportedOperationException("Not implemented: getInstanceCallable()"); } @@ -171,6 +195,53 @@ public UnaryCallable getIamPolicyCallable() { throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()"); } + public UnaryCallable + getInstancePartitionCallable() { + throw new UnsupportedOperationException("Not implemented: getInstancePartitionCallable()"); + } + + public OperationCallable< + CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata> + createInstancePartitionOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: createInstancePartitionOperationCallable()"); + } + + public UnaryCallable + createInstancePartitionCallable() { + throw new UnsupportedOperationException("Not implemented: createInstancePartitionCallable()"); + } + + public UnaryCallable deleteInstancePartitionCallable() { + throw new UnsupportedOperationException("Not implemented: deleteInstancePartitionCallable()"); + } + + public OperationCallable< + UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata> + updateInstancePartitionOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: updateInstancePartitionOperationCallable()"); + } + + public UnaryCallable + updateInstancePartitionCallable() { + throw new UnsupportedOperationException("Not implemented: updateInstancePartitionCallable()"); + } + + public UnaryCallable< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsPagedResponse> + listInstancePartitionOperationsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listInstancePartitionOperationsPagedCallable()"); + } + + public UnaryCallable< + ListInstancePartitionOperationsRequest, ListInstancePartitionOperationsResponse> + listInstancePartitionOperationsCallable() { + throw new UnsupportedOperationException( + "Not implemented: listInstancePartitionOperationsCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/InstanceAdminStubSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/InstanceAdminStubSettings.java index 124c38e7adb..36454ee1a55 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/InstanceAdminStubSettings.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/InstanceAdminStubSettings.java @@ -18,6 +18,8 @@ import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigOperationsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionOperationsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancesPagedResponse; import com.google.api.core.ApiFunction; @@ -63,22 +65,33 @@ import com.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata; import com.google.spanner.admin.instance.v1.CreateInstanceConfigRequest; import com.google.spanner.admin.instance.v1.CreateInstanceMetadata; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.CreateInstanceRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceRequest; import com.google.spanner.admin.instance.v1.GetInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.GetInstancePartitionRequest; import com.google.spanner.admin.instance.v1.GetInstanceRequest; import com.google.spanner.admin.instance.v1.Instance; import com.google.spanner.admin.instance.v1.InstanceConfig; +import com.google.spanner.admin.instance.v1.InstancePartition; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse; import com.google.spanner.admin.instance.v1.ListInstanceConfigsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse; import com.google.spanner.admin.instance.v1.ListInstancesRequest; import com.google.spanner.admin.instance.v1.ListInstancesResponse; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceMetadata; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceRequest; import java.io.IOException; import java.util.List; @@ -155,6 +168,11 @@ public class InstanceAdminStubSettings extends StubSettings listInstancesSettings; + private final PagedCallSettings< + ListInstancePartitionsRequest, + ListInstancePartitionsResponse, + ListInstancePartitionsPagedResponse> + listInstancePartitionsSettings; private final UnaryCallSettings getInstanceSettings; private final UnaryCallSettings createInstanceSettings; private final OperationCallSettings @@ -167,6 +185,25 @@ public class InstanceAdminStubSettings extends StubSettings getIamPolicySettings; private final UnaryCallSettings testIamPermissionsSettings; + private final UnaryCallSettings + getInstancePartitionSettings; + private final UnaryCallSettings + createInstancePartitionSettings; + private final OperationCallSettings< + CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata> + createInstancePartitionOperationSettings; + private final UnaryCallSettings + deleteInstancePartitionSettings; + private final UnaryCallSettings + updateInstancePartitionSettings; + private final OperationCallSettings< + UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata> + updateInstancePartitionOperationSettings; + private final PagedCallSettings< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + ListInstancePartitionOperationsPagedResponse> + listInstancePartitionOperationsSettings; private static final PagedListDescriptor< ListInstanceConfigsRequest, ListInstanceConfigsResponse, InstanceConfig> @@ -291,6 +328,98 @@ public Iterable extractResources(ListInstancesResponse payload) { } }; + private static final PagedListDescriptor< + ListInstancePartitionsRequest, ListInstancePartitionsResponse, InstancePartition> + LIST_INSTANCE_PARTITIONS_PAGE_STR_DESC = + new PagedListDescriptor< + ListInstancePartitionsRequest, ListInstancePartitionsResponse, InstancePartition>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListInstancePartitionsRequest injectToken( + ListInstancePartitionsRequest payload, String token) { + return ListInstancePartitionsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListInstancePartitionsRequest injectPageSize( + ListInstancePartitionsRequest payload, int pageSize) { + return ListInstancePartitionsRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListInstancePartitionsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListInstancePartitionsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListInstancePartitionsResponse payload) { + return payload.getInstancePartitionsList() == null + ? ImmutableList.of() + : payload.getInstancePartitionsList(); + } + }; + + private static final PagedListDescriptor< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + Operation> + LIST_INSTANCE_PARTITION_OPERATIONS_PAGE_STR_DESC = + new PagedListDescriptor< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + Operation>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListInstancePartitionOperationsRequest injectToken( + ListInstancePartitionOperationsRequest payload, String token) { + return ListInstancePartitionOperationsRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListInstancePartitionOperationsRequest injectPageSize( + ListInstancePartitionOperationsRequest payload, int pageSize) { + return ListInstancePartitionOperationsRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListInstancePartitionOperationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListInstancePartitionOperationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListInstancePartitionOperationsResponse payload) { + return payload.getOperationsList() == null + ? ImmutableList.of() + : payload.getOperationsList(); + } + }; + private static final PagedListResponseFactory< ListInstanceConfigsRequest, ListInstanceConfigsResponse, ListInstanceConfigsPagedResponse> LIST_INSTANCE_CONFIGS_PAGE_STR_FACT = @@ -361,6 +490,66 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListInstancePartitionsRequest, + ListInstancePartitionsResponse, + ListInstancePartitionsPagedResponse> + LIST_INSTANCE_PARTITIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListInstancePartitionsRequest, + ListInstancePartitionsResponse, + ListInstancePartitionsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListInstancePartitionsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListInstancePartitionsRequest, + ListInstancePartitionsResponse, + InstancePartition> + pageContext = + PageContext.create( + callable, LIST_INSTANCE_PARTITIONS_PAGE_STR_DESC, request, context); + return ListInstancePartitionsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + ListInstancePartitionOperationsPagedResponse> + LIST_INSTANCE_PARTITION_OPERATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + ListInstancePartitionOperationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse> + callable, + ListInstancePartitionOperationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + Operation> + pageContext = + PageContext.create( + callable, + LIST_INSTANCE_PARTITION_OPERATIONS_PAGE_STR_DESC, + request, + context); + return ListInstancePartitionOperationsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listInstanceConfigs. */ public PagedCallSettings< ListInstanceConfigsRequest, ListInstanceConfigsResponse, ListInstanceConfigsPagedResponse> @@ -417,6 +606,15 @@ public UnaryCallSettings deleteInstanceConfi return listInstancesSettings; } + /** Returns the object with the settings used for calls to listInstancePartitions. */ + public PagedCallSettings< + ListInstancePartitionsRequest, + ListInstancePartitionsResponse, + ListInstancePartitionsPagedResponse> + listInstancePartitionsSettings() { + return listInstancePartitionsSettings; + } + /** Returns the object with the settings used for calls to getInstance. */ public UnaryCallSettings getInstanceSettings() { return getInstanceSettings; @@ -465,6 +663,53 @@ public UnaryCallSettings getIamPolicySettings() { return testIamPermissionsSettings; } + /** Returns the object with the settings used for calls to getInstancePartition. */ + public UnaryCallSettings + getInstancePartitionSettings() { + return getInstancePartitionSettings; + } + + /** Returns the object with the settings used for calls to createInstancePartition. */ + public UnaryCallSettings + createInstancePartitionSettings() { + return createInstancePartitionSettings; + } + + /** Returns the object with the settings used for calls to createInstancePartition. */ + public OperationCallSettings< + CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata> + createInstancePartitionOperationSettings() { + return createInstancePartitionOperationSettings; + } + + /** Returns the object with the settings used for calls to deleteInstancePartition. */ + public UnaryCallSettings + deleteInstancePartitionSettings() { + return deleteInstancePartitionSettings; + } + + /** Returns the object with the settings used for calls to updateInstancePartition. */ + public UnaryCallSettings + updateInstancePartitionSettings() { + return updateInstancePartitionSettings; + } + + /** Returns the object with the settings used for calls to updateInstancePartition. */ + public OperationCallSettings< + UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata> + updateInstancePartitionOperationSettings() { + return updateInstancePartitionOperationSettings; + } + + /** Returns the object with the settings used for calls to listInstancePartitionOperations. */ + public PagedCallSettings< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + ListInstancePartitionOperationsPagedResponse> + listInstancePartitionOperationsSettings() { + return listInstancePartitionOperationsSettings; + } + public InstanceAdminStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -596,6 +841,7 @@ protected InstanceAdminStubSettings(Builder settingsBuilder) throws IOException listInstanceConfigOperationsSettings = settingsBuilder.listInstanceConfigOperationsSettings().build(); listInstancesSettings = settingsBuilder.listInstancesSettings().build(); + listInstancePartitionsSettings = settingsBuilder.listInstancePartitionsSettings().build(); getInstanceSettings = settingsBuilder.getInstanceSettings().build(); createInstanceSettings = settingsBuilder.createInstanceSettings().build(); createInstanceOperationSettings = settingsBuilder.createInstanceOperationSettings().build(); @@ -605,6 +851,16 @@ protected InstanceAdminStubSettings(Builder settingsBuilder) throws IOException setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); + getInstancePartitionSettings = settingsBuilder.getInstancePartitionSettings().build(); + createInstancePartitionSettings = settingsBuilder.createInstancePartitionSettings().build(); + createInstancePartitionOperationSettings = + settingsBuilder.createInstancePartitionOperationSettings().build(); + deleteInstancePartitionSettings = settingsBuilder.deleteInstancePartitionSettings().build(); + updateInstancePartitionSettings = settingsBuilder.updateInstancePartitionSettings().build(); + updateInstancePartitionOperationSettings = + settingsBuilder.updateInstancePartitionOperationSettings().build(); + listInstancePartitionOperationsSettings = + settingsBuilder.listInstancePartitionOperationsSettings().build(); } /** Builder for InstanceAdminStubSettings. */ @@ -637,6 +893,11 @@ public static class Builder extends StubSettings.Builder listInstancesSettings; + private final PagedCallSettings.Builder< + ListInstancePartitionsRequest, + ListInstancePartitionsResponse, + ListInstancePartitionsPagedResponse> + listInstancePartitionsSettings; private final UnaryCallSettings.Builder getInstanceSettings; private final UnaryCallSettings.Builder createInstanceSettings; @@ -653,6 +914,25 @@ public static class Builder extends StubSettings.Builder getIamPolicySettings; private final UnaryCallSettings.Builder testIamPermissionsSettings; + private final UnaryCallSettings.Builder + getInstancePartitionSettings; + private final UnaryCallSettings.Builder + createInstancePartitionSettings; + private final OperationCallSettings.Builder< + CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata> + createInstancePartitionOperationSettings; + private final UnaryCallSettings.Builder + deleteInstancePartitionSettings; + private final UnaryCallSettings.Builder + updateInstancePartitionSettings; + private final OperationCallSettings.Builder< + UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata> + updateInstancePartitionOperationSettings; + private final PagedCallSettings.Builder< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + ListInstancePartitionOperationsPagedResponse> + listInstancePartitionOperationsSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -743,6 +1023,8 @@ protected Builder(ClientContext clientContext) { listInstanceConfigOperationsSettings = PagedCallSettings.newBuilder(LIST_INSTANCE_CONFIG_OPERATIONS_PAGE_STR_FACT); listInstancesSettings = PagedCallSettings.newBuilder(LIST_INSTANCES_PAGE_STR_FACT); + listInstancePartitionsSettings = + PagedCallSettings.newBuilder(LIST_INSTANCE_PARTITIONS_PAGE_STR_FACT); getInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); createInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); createInstanceOperationSettings = OperationCallSettings.newBuilder(); @@ -752,6 +1034,14 @@ protected Builder(ClientContext clientContext) { setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + getInstancePartitionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createInstancePartitionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createInstancePartitionOperationSettings = OperationCallSettings.newBuilder(); + deleteInstancePartitionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateInstancePartitionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateInstancePartitionOperationSettings = OperationCallSettings.newBuilder(); + listInstancePartitionOperationsSettings = + PagedCallSettings.newBuilder(LIST_INSTANCE_PARTITION_OPERATIONS_PAGE_STR_FACT); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -762,13 +1052,19 @@ protected Builder(ClientContext clientContext) { deleteInstanceConfigSettings, listInstanceConfigOperationsSettings, listInstancesSettings, + listInstancePartitionsSettings, getInstanceSettings, createInstanceSettings, updateInstanceSettings, deleteInstanceSettings, setIamPolicySettings, getIamPolicySettings, - testIamPermissionsSettings); + testIamPermissionsSettings, + getInstancePartitionSettings, + createInstancePartitionSettings, + deleteInstancePartitionSettings, + updateInstancePartitionSettings, + listInstancePartitionOperationsSettings); initDefaults(this); } @@ -787,6 +1083,7 @@ protected Builder(InstanceAdminStubSettings settings) { listInstanceConfigOperationsSettings = settings.listInstanceConfigOperationsSettings.toBuilder(); listInstancesSettings = settings.listInstancesSettings.toBuilder(); + listInstancePartitionsSettings = settings.listInstancePartitionsSettings.toBuilder(); getInstanceSettings = settings.getInstanceSettings.toBuilder(); createInstanceSettings = settings.createInstanceSettings.toBuilder(); createInstanceOperationSettings = settings.createInstanceOperationSettings.toBuilder(); @@ -796,6 +1093,16 @@ protected Builder(InstanceAdminStubSettings settings) { setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); + getInstancePartitionSettings = settings.getInstancePartitionSettings.toBuilder(); + createInstancePartitionSettings = settings.createInstancePartitionSettings.toBuilder(); + createInstancePartitionOperationSettings = + settings.createInstancePartitionOperationSettings.toBuilder(); + deleteInstancePartitionSettings = settings.deleteInstancePartitionSettings.toBuilder(); + updateInstancePartitionSettings = settings.updateInstancePartitionSettings.toBuilder(); + updateInstancePartitionOperationSettings = + settings.updateInstancePartitionOperationSettings.toBuilder(); + listInstancePartitionOperationsSettings = + settings.listInstancePartitionOperationsSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -806,13 +1113,19 @@ protected Builder(InstanceAdminStubSettings settings) { deleteInstanceConfigSettings, listInstanceConfigOperationsSettings, listInstancesSettings, + listInstancePartitionsSettings, getInstanceSettings, createInstanceSettings, updateInstanceSettings, deleteInstanceSettings, setIamPolicySettings, getIamPolicySettings, - testIamPermissionsSettings); + testIamPermissionsSettings, + getInstancePartitionSettings, + createInstancePartitionSettings, + deleteInstancePartitionSettings, + updateInstancePartitionSettings, + listInstancePartitionOperationsSettings); } private static Builder createDefault() { @@ -875,6 +1188,11 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .listInstancePartitionsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + builder .getInstanceSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) @@ -910,6 +1228,31 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_3_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_3_params")); + builder + .getInstancePartitionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .createInstancePartitionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .deleteInstancePartitionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .updateInstancePartitionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .listInstancePartitionOperationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + builder .createInstanceConfigOperationSettings() .setInitialCallSettings( @@ -1008,6 +1351,56 @@ private static Builder initDefaults(Builder builder) { .setTotalTimeout(Duration.ofMillis(86400000L)) .build())); + builder + .createInstancePartitionOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(InstancePartition.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create( + CreateInstancePartitionMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .updateInstancePartitionOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(InstancePartition.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create( + UpdateInstancePartitionMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + return builder; } @@ -1048,8 +1441,6 @@ public Builder applyToAllUnaryMethods( } /** Returns the builder for the settings used for calls to createInstanceConfig. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder< CreateInstanceConfigRequest, InstanceConfig, CreateInstanceConfigMetadata> createInstanceConfigOperationSettings() { @@ -1063,8 +1454,6 @@ public Builder applyToAllUnaryMethods( } /** Returns the builder for the settings used for calls to updateInstanceConfig. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder< UpdateInstanceConfigRequest, InstanceConfig, UpdateInstanceConfigMetadata> updateInstanceConfigOperationSettings() { @@ -1093,6 +1482,15 @@ public Builder applyToAllUnaryMethods( return listInstancesSettings; } + /** Returns the builder for the settings used for calls to listInstancePartitions. */ + public PagedCallSettings.Builder< + ListInstancePartitionsRequest, + ListInstancePartitionsResponse, + ListInstancePartitionsPagedResponse> + listInstancePartitionsSettings() { + return listInstancePartitionsSettings; + } + /** Returns the builder for the settings used for calls to getInstance. */ public UnaryCallSettings.Builder getInstanceSettings() { return getInstanceSettings; @@ -1104,8 +1502,6 @@ public UnaryCallSettings.Builder createInstanc } /** Returns the builder for the settings used for calls to createInstance. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder createInstanceOperationSettings() { return createInstanceOperationSettings; @@ -1117,8 +1513,6 @@ public UnaryCallSettings.Builder updateInstanc } /** Returns the builder for the settings used for calls to updateInstance. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder updateInstanceOperationSettings() { return updateInstanceOperationSettings; @@ -1145,6 +1539,53 @@ public UnaryCallSettings.Builder getIamPolicySettin return testIamPermissionsSettings; } + /** Returns the builder for the settings used for calls to getInstancePartition. */ + public UnaryCallSettings.Builder + getInstancePartitionSettings() { + return getInstancePartitionSettings; + } + + /** Returns the builder for the settings used for calls to createInstancePartition. */ + public UnaryCallSettings.Builder + createInstancePartitionSettings() { + return createInstancePartitionSettings; + } + + /** Returns the builder for the settings used for calls to createInstancePartition. */ + public OperationCallSettings.Builder< + CreateInstancePartitionRequest, InstancePartition, CreateInstancePartitionMetadata> + createInstancePartitionOperationSettings() { + return createInstancePartitionOperationSettings; + } + + /** Returns the builder for the settings used for calls to deleteInstancePartition. */ + public UnaryCallSettings.Builder + deleteInstancePartitionSettings() { + return deleteInstancePartitionSettings; + } + + /** Returns the builder for the settings used for calls to updateInstancePartition. */ + public UnaryCallSettings.Builder + updateInstancePartitionSettings() { + return updateInstancePartitionSettings; + } + + /** Returns the builder for the settings used for calls to updateInstancePartition. */ + public OperationCallSettings.Builder< + UpdateInstancePartitionRequest, InstancePartition, UpdateInstancePartitionMetadata> + updateInstancePartitionOperationSettings() { + return updateInstancePartitionOperationSettings; + } + + /** Returns the builder for the settings used for calls to listInstancePartitionOperations. */ + public PagedCallSettings.Builder< + ListInstancePartitionOperationsRequest, + ListInstancePartitionOperationsResponse, + ListInstancePartitionOperationsPagedResponse> + listInstancePartitionOperationsSettings() { + return listInstancePartitionOperationsSettings; + } + /** Returns the endpoint set by the user or the the service's default endpoint. */ @Override public String getEndpoint() { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerSettings.java index d1502689d82..a785ff6d993 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerSettings.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerSettings.java @@ -234,7 +234,6 @@ public static Builder newBuilder() { } /** Returns a new REST builder for this class. */ - @BetaApi public static Builder newHttpJsonBuilder() { return Builder.createHttpJsonDefault(); } @@ -276,7 +275,6 @@ private static Builder createDefault() { return new Builder(SpannerStubSettings.newBuilder()); } - @BetaApi private static Builder createHttpJsonDefault() { return new Builder(SpannerStubSettings.newHttpJsonBuilder()); } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/HttpJsonSpannerCallableFactory.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/HttpJsonSpannerCallableFactory.java index aa35e6adbb7..4368496c416 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/HttpJsonSpannerCallableFactory.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/HttpJsonSpannerCallableFactory.java @@ -16,7 +16,6 @@ package com.google.cloud.spanner.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.httpjson.HttpJsonCallSettings; import com.google.api.gax.httpjson.HttpJsonCallableFactory; import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; @@ -41,7 +40,6 @@ *

This class is for advanced usage. */ @Generated("by gapic-generator-java") -@BetaApi public class HttpJsonSpannerCallableFactory implements HttpJsonStubCallableFactory { @@ -73,8 +71,6 @@ public UnaryCallable createBatchingCa httpJsonCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/HttpJsonSpannerStub.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/HttpJsonSpannerStub.java index 10e6962478d..5ba7eb584af 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/HttpJsonSpannerStub.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/HttpJsonSpannerStub.java @@ -18,7 +18,6 @@ import static com.google.cloud.spanner.v1.SpannerClient.ListSessionsPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -73,7 +72,6 @@ *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator-java") -@BetaApi public class HttpJsonSpannerStub extends SpannerStub { private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); diff --git a/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.admin.instance.v1/reflect-config.json b/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.admin.instance.v1/reflect-config.json index feebefee603..a01e9dbb010 100644 --- a/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.admin.instance.v1/reflect-config.json +++ b/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.admin.instance.v1/reflect-config.json @@ -1709,6 +1709,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.CreateInstanceRequest", "queryAllDeclaredConstructors": true, @@ -1745,6 +1781,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.DeleteInstanceRequest", "queryAllDeclaredConstructors": true, @@ -1781,6 +1835,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.GetInstancePartitionRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.GetInstancePartitionRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.GetInstanceRequest", "queryAllDeclaredConstructors": true, @@ -1862,6 +1934,33 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.InstancePartition", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.InstancePartition$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.InstancePartition$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest", "queryAllDeclaredConstructors": true, @@ -1934,6 +2033,78 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.ListInstancesRequest", "queryAllDeclaredConstructors": true, @@ -2069,6 +2240,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.UpdateInstanceRequest", "queryAllDeclaredConstructors": true, diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientHttpJsonTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientHttpJsonTest.java index 58505c0a000..99d8138ad93 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientHttpJsonTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientHttpJsonTest.java @@ -18,6 +18,8 @@ import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigOperationsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionOperationsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancesPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -47,8 +49,12 @@ import com.google.spanner.admin.instance.v1.InstanceConfig; import com.google.spanner.admin.instance.v1.InstanceConfigName; import com.google.spanner.admin.instance.v1.InstanceName; +import com.google.spanner.admin.instance.v1.InstancePartition; +import com.google.spanner.admin.instance.v1.InstancePartitionName; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse; import com.google.spanner.admin.instance.v1.ListInstanceConfigsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse; import com.google.spanner.admin.instance.v1.ListInstancesResponse; import com.google.spanner.admin.instance.v1.ProjectName; import com.google.spanner.admin.instance.v1.ReplicaInfo; @@ -793,6 +799,106 @@ public void listInstancesExceptionTest2() throws Exception { } } + @Test + public void listInstancePartitionsTest() throws Exception { + InstancePartition responsesElement = InstancePartition.newBuilder().build(); + ListInstancePartitionsResponse expectedResponse = + ListInstancePartitionsResponse.newBuilder() + .setNextPageToken("") + .addAllInstancePartitions(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + + ListInstancePartitionsPagedResponse pagedListResponse = client.listInstancePartitions(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInstancePartitionsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listInstancePartitionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + client.listInstancePartitions(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listInstancePartitionsTest2() throws Exception { + InstancePartition responsesElement = InstancePartition.newBuilder().build(); + ListInstancePartitionsResponse expectedResponse = + ListInstancePartitionsResponse.newBuilder() + .setNextPageToken("") + .addAllInstancePartitions(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-8887/instances/instance-8887"; + + ListInstancePartitionsPagedResponse pagedListResponse = client.listInstancePartitions(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInstancePartitionsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listInstancePartitionsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-8887/instances/instance-8887"; + client.listInstancePartitions(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test public void getInstanceTest() throws Exception { Instance expectedResponse = @@ -1466,4 +1572,511 @@ public void testIamPermissionsExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void getInstancePartitionTest() throws Exception { + InstancePartition expectedResponse = + InstancePartition.newBuilder() + .setName( + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]") + .toString()) + .setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllReferencingDatabases(new ArrayList()) + .addAllReferencingBackups(new ArrayList()) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + InstancePartitionName name = + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]"); + + InstancePartition actualResponse = client.getInstancePartition(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getInstancePartitionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InstancePartitionName name = + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]"); + client.getInstancePartition(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getInstancePartitionTest2() throws Exception { + InstancePartition expectedResponse = + InstancePartition.newBuilder() + .setName( + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]") + .toString()) + .setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllReferencingDatabases(new ArrayList()) + .addAllReferencingBackups(new ArrayList()) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-9266/instances/instance-9266/instancePartitions/instancePartition-9266"; + + InstancePartition actualResponse = client.getInstancePartition(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getInstancePartitionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9266/instances/instance-9266/instancePartitions/instancePartition-9266"; + client.getInstancePartition(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createInstancePartitionTest() throws Exception { + InstancePartition expectedResponse = + InstancePartition.newBuilder() + .setName( + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]") + .toString()) + .setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllReferencingDatabases(new ArrayList()) + .addAllReferencingBackups(new ArrayList()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createInstancePartitionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + InstancePartition instancePartition = InstancePartition.newBuilder().build(); + String instancePartitionId = "instancePartitionId1364450768"; + + InstancePartition actualResponse = + client.createInstancePartitionAsync(parent, instancePartition, instancePartitionId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createInstancePartitionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + InstancePartition instancePartition = InstancePartition.newBuilder().build(); + String instancePartitionId = "instancePartitionId1364450768"; + client.createInstancePartitionAsync(parent, instancePartition, instancePartitionId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createInstancePartitionTest2() throws Exception { + InstancePartition expectedResponse = + InstancePartition.newBuilder() + .setName( + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]") + .toString()) + .setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllReferencingDatabases(new ArrayList()) + .addAllReferencingBackups(new ArrayList()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createInstancePartitionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-8887/instances/instance-8887"; + InstancePartition instancePartition = InstancePartition.newBuilder().build(); + String instancePartitionId = "instancePartitionId1364450768"; + + InstancePartition actualResponse = + client.createInstancePartitionAsync(parent, instancePartition, instancePartitionId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createInstancePartitionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-8887/instances/instance-8887"; + InstancePartition instancePartition = InstancePartition.newBuilder().build(); + String instancePartitionId = "instancePartitionId1364450768"; + client.createInstancePartitionAsync(parent, instancePartition, instancePartitionId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteInstancePartitionTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + InstancePartitionName name = + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]"); + + client.deleteInstancePartition(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteInstancePartitionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InstancePartitionName name = + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]"); + client.deleteInstancePartition(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteInstancePartitionTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-9266/instances/instance-9266/instancePartitions/instancePartition-9266"; + + client.deleteInstancePartition(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteInstancePartitionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9266/instances/instance-9266/instancePartitions/instancePartition-9266"; + client.deleteInstancePartition(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateInstancePartitionTest() throws Exception { + InstancePartition expectedResponse = + InstancePartition.newBuilder() + .setName( + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]") + .toString()) + .setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllReferencingDatabases(new ArrayList()) + .addAllReferencingBackups(new ArrayList()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateInstancePartitionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + InstancePartition instancePartition = + InstancePartition.newBuilder() + .setName( + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]") + .toString()) + .setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllReferencingDatabases(new ArrayList()) + .addAllReferencingBackups(new ArrayList()) + .setEtag("etag3123477") + .build(); + FieldMask fieldMask = FieldMask.newBuilder().build(); + + InstancePartition actualResponse = + client.updateInstancePartitionAsync(instancePartition, fieldMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateInstancePartitionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InstancePartition instancePartition = + InstancePartition.newBuilder() + .setName( + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]") + .toString()) + .setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllReferencingDatabases(new ArrayList()) + .addAllReferencingBackups(new ArrayList()) + .setEtag("etag3123477") + .build(); + FieldMask fieldMask = FieldMask.newBuilder().build(); + client.updateInstancePartitionAsync(instancePartition, fieldMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listInstancePartitionOperationsTest() throws Exception { + Operation responsesElement = Operation.newBuilder().build(); + ListInstancePartitionOperationsResponse expectedResponse = + ListInstancePartitionOperationsResponse.newBuilder() + .setNextPageToken("") + .addAllOperations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + + ListInstancePartitionOperationsPagedResponse pagedListResponse = + client.listInstancePartitionOperations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getOperationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listInstancePartitionOperationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + client.listInstancePartitionOperations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listInstancePartitionOperationsTest2() throws Exception { + Operation responsesElement = Operation.newBuilder().build(); + ListInstancePartitionOperationsResponse expectedResponse = + ListInstancePartitionOperationsResponse.newBuilder() + .setNextPageToken("") + .addAllOperations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-8887/instances/instance-8887"; + + ListInstancePartitionOperationsPagedResponse pagedListResponse = + client.listInstancePartitionOperations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getOperationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listInstancePartitionOperationsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-8887/instances/instance-8887"; + client.listInstancePartitionOperations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientTest.java index b52443ddac7..fbd9ca6c40d 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientTest.java @@ -18,6 +18,8 @@ import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigOperationsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstanceConfigsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionOperationsPagedResponse; +import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancePartitionsPagedResponse; import static com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient.ListInstancesPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; @@ -46,24 +48,34 @@ import com.google.protobuf.Timestamp; import com.google.spanner.admin.instance.v1.AutoscalingConfig; import com.google.spanner.admin.instance.v1.CreateInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.CreateInstanceRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceRequest; import com.google.spanner.admin.instance.v1.GetInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.GetInstancePartitionRequest; import com.google.spanner.admin.instance.v1.GetInstanceRequest; import com.google.spanner.admin.instance.v1.Instance; import com.google.spanner.admin.instance.v1.InstanceConfig; import com.google.spanner.admin.instance.v1.InstanceConfigName; import com.google.spanner.admin.instance.v1.InstanceName; +import com.google.spanner.admin.instance.v1.InstancePartition; +import com.google.spanner.admin.instance.v1.InstancePartitionName; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse; import com.google.spanner.admin.instance.v1.ListInstanceConfigsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse; import com.google.spanner.admin.instance.v1.ListInstancesRequest; import com.google.spanner.admin.instance.v1.ListInstancesResponse; import com.google.spanner.admin.instance.v1.ProjectName; import com.google.spanner.admin.instance.v1.ReplicaInfo; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceRequest; import io.grpc.StatusRuntimeException; import java.io.IOException; @@ -732,6 +744,96 @@ public void listInstancesExceptionTest2() throws Exception { } } + @Test + public void listInstancePartitionsTest() throws Exception { + InstancePartition responsesElement = InstancePartition.newBuilder().build(); + ListInstancePartitionsResponse expectedResponse = + ListInstancePartitionsResponse.newBuilder() + .setNextPageToken("") + .addAllInstancePartitions(Arrays.asList(responsesElement)) + .build(); + mockInstanceAdmin.addResponse(expectedResponse); + + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + + ListInstancePartitionsPagedResponse pagedListResponse = client.listInstancePartitions(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInstancePartitionsList().get(0), resources.get(0)); + + List actualRequests = mockInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListInstancePartitionsRequest actualRequest = + ((ListInstancePartitionsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listInstancePartitionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockInstanceAdmin.addException(exception); + + try { + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + client.listInstancePartitions(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listInstancePartitionsTest2() throws Exception { + InstancePartition responsesElement = InstancePartition.newBuilder().build(); + ListInstancePartitionsResponse expectedResponse = + ListInstancePartitionsResponse.newBuilder() + .setNextPageToken("") + .addAllInstancePartitions(Arrays.asList(responsesElement)) + .build(); + mockInstanceAdmin.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListInstancePartitionsPagedResponse pagedListResponse = client.listInstancePartitions(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInstancePartitionsList().get(0), resources.get(0)); + + List actualRequests = mockInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListInstancePartitionsRequest actualRequest = + ((ListInstancePartitionsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listInstancePartitionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockInstanceAdmin.addException(exception); + + try { + String parent = "parent-995424086"; + client.listInstancePartitions(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test public void getInstanceTest() throws Exception { Instance expectedResponse = @@ -1321,4 +1423,452 @@ public void testIamPermissionsExceptionTest2() throws Exception { // Expected exception. } } + + @Test + public void getInstancePartitionTest() throws Exception { + InstancePartition expectedResponse = + InstancePartition.newBuilder() + .setName( + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]") + .toString()) + .setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllReferencingDatabases(new ArrayList()) + .addAllReferencingBackups(new ArrayList()) + .setEtag("etag3123477") + .build(); + mockInstanceAdmin.addResponse(expectedResponse); + + InstancePartitionName name = + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]"); + + InstancePartition actualResponse = client.getInstancePartition(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetInstancePartitionRequest actualRequest = + ((GetInstancePartitionRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getInstancePartitionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockInstanceAdmin.addException(exception); + + try { + InstancePartitionName name = + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]"); + client.getInstancePartition(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getInstancePartitionTest2() throws Exception { + InstancePartition expectedResponse = + InstancePartition.newBuilder() + .setName( + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]") + .toString()) + .setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllReferencingDatabases(new ArrayList()) + .addAllReferencingBackups(new ArrayList()) + .setEtag("etag3123477") + .build(); + mockInstanceAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + + InstancePartition actualResponse = client.getInstancePartition(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetInstancePartitionRequest actualRequest = + ((GetInstancePartitionRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getInstancePartitionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockInstanceAdmin.addException(exception); + + try { + String name = "name3373707"; + client.getInstancePartition(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createInstancePartitionTest() throws Exception { + InstancePartition expectedResponse = + InstancePartition.newBuilder() + .setName( + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]") + .toString()) + .setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllReferencingDatabases(new ArrayList()) + .addAllReferencingBackups(new ArrayList()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createInstancePartitionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockInstanceAdmin.addResponse(resultOperation); + + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + InstancePartition instancePartition = InstancePartition.newBuilder().build(); + String instancePartitionId = "instancePartitionId1364450768"; + + InstancePartition actualResponse = + client.createInstancePartitionAsync(parent, instancePartition, instancePartitionId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateInstancePartitionRequest actualRequest = + ((CreateInstancePartitionRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(instancePartition, actualRequest.getInstancePartition()); + Assert.assertEquals(instancePartitionId, actualRequest.getInstancePartitionId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createInstancePartitionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockInstanceAdmin.addException(exception); + + try { + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + InstancePartition instancePartition = InstancePartition.newBuilder().build(); + String instancePartitionId = "instancePartitionId1364450768"; + client.createInstancePartitionAsync(parent, instancePartition, instancePartitionId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createInstancePartitionTest2() throws Exception { + InstancePartition expectedResponse = + InstancePartition.newBuilder() + .setName( + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]") + .toString()) + .setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllReferencingDatabases(new ArrayList()) + .addAllReferencingBackups(new ArrayList()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createInstancePartitionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockInstanceAdmin.addResponse(resultOperation); + + String parent = "parent-995424086"; + InstancePartition instancePartition = InstancePartition.newBuilder().build(); + String instancePartitionId = "instancePartitionId1364450768"; + + InstancePartition actualResponse = + client.createInstancePartitionAsync(parent, instancePartition, instancePartitionId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateInstancePartitionRequest actualRequest = + ((CreateInstancePartitionRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(instancePartition, actualRequest.getInstancePartition()); + Assert.assertEquals(instancePartitionId, actualRequest.getInstancePartitionId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createInstancePartitionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockInstanceAdmin.addException(exception); + + try { + String parent = "parent-995424086"; + InstancePartition instancePartition = InstancePartition.newBuilder().build(); + String instancePartitionId = "instancePartitionId1364450768"; + client.createInstancePartitionAsync(parent, instancePartition, instancePartitionId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteInstancePartitionTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockInstanceAdmin.addResponse(expectedResponse); + + InstancePartitionName name = + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]"); + + client.deleteInstancePartition(name); + + List actualRequests = mockInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteInstancePartitionRequest actualRequest = + ((DeleteInstancePartitionRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteInstancePartitionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockInstanceAdmin.addException(exception); + + try { + InstancePartitionName name = + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]"); + client.deleteInstancePartition(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteInstancePartitionTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockInstanceAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteInstancePartition(name); + + List actualRequests = mockInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteInstancePartitionRequest actualRequest = + ((DeleteInstancePartitionRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteInstancePartitionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockInstanceAdmin.addException(exception); + + try { + String name = "name3373707"; + client.deleteInstancePartition(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateInstancePartitionTest() throws Exception { + InstancePartition expectedResponse = + InstancePartition.newBuilder() + .setName( + InstancePartitionName.of("[PROJECT]", "[INSTANCE]", "[INSTANCE_PARTITION]") + .toString()) + .setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllReferencingDatabases(new ArrayList()) + .addAllReferencingBackups(new ArrayList()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateInstancePartitionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockInstanceAdmin.addResponse(resultOperation); + + InstancePartition instancePartition = InstancePartition.newBuilder().build(); + FieldMask fieldMask = FieldMask.newBuilder().build(); + + InstancePartition actualResponse = + client.updateInstancePartitionAsync(instancePartition, fieldMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateInstancePartitionRequest actualRequest = + ((UpdateInstancePartitionRequest) actualRequests.get(0)); + + Assert.assertEquals(instancePartition, actualRequest.getInstancePartition()); + Assert.assertEquals(fieldMask, actualRequest.getFieldMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateInstancePartitionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockInstanceAdmin.addException(exception); + + try { + InstancePartition instancePartition = InstancePartition.newBuilder().build(); + FieldMask fieldMask = FieldMask.newBuilder().build(); + client.updateInstancePartitionAsync(instancePartition, fieldMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void listInstancePartitionOperationsTest() throws Exception { + Operation responsesElement = Operation.newBuilder().build(); + ListInstancePartitionOperationsResponse expectedResponse = + ListInstancePartitionOperationsResponse.newBuilder() + .setNextPageToken("") + .addAllOperations(Arrays.asList(responsesElement)) + .build(); + mockInstanceAdmin.addResponse(expectedResponse); + + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + + ListInstancePartitionOperationsPagedResponse pagedListResponse = + client.listInstancePartitionOperations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getOperationsList().get(0), resources.get(0)); + + List actualRequests = mockInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListInstancePartitionOperationsRequest actualRequest = + ((ListInstancePartitionOperationsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listInstancePartitionOperationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockInstanceAdmin.addException(exception); + + try { + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + client.listInstancePartitionOperations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listInstancePartitionOperationsTest2() throws Exception { + Operation responsesElement = Operation.newBuilder().build(); + ListInstancePartitionOperationsResponse expectedResponse = + ListInstancePartitionOperationsResponse.newBuilder() + .setNextPageToken("") + .addAllOperations(Arrays.asList(responsesElement)) + .build(); + mockInstanceAdmin.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListInstancePartitionOperationsPagedResponse pagedListResponse = + client.listInstancePartitionOperations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getOperationsList().get(0), resources.get(0)); + + List actualRequests = mockInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListInstancePartitionOperationsRequest actualRequest = + ((ListInstancePartitionOperationsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listInstancePartitionOperationsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockInstanceAdmin.addException(exception); + + try { + String parent = "parent-995424086"; + client.listInstancePartitionOperations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/MockInstanceAdminImpl.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/MockInstanceAdminImpl.java index c1a9a122277..b6f95a3f504 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/MockInstanceAdminImpl.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/MockInstanceAdminImpl.java @@ -26,21 +26,30 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; import com.google.spanner.admin.instance.v1.CreateInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.CreateInstanceRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest; import com.google.spanner.admin.instance.v1.DeleteInstanceRequest; import com.google.spanner.admin.instance.v1.GetInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.GetInstancePartitionRequest; import com.google.spanner.admin.instance.v1.GetInstanceRequest; import com.google.spanner.admin.instance.v1.Instance; import com.google.spanner.admin.instance.v1.InstanceAdminGrpc.InstanceAdminImplBase; import com.google.spanner.admin.instance.v1.InstanceConfig; +import com.google.spanner.admin.instance.v1.InstancePartition; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse; import com.google.spanner.admin.instance.v1.ListInstanceConfigsRequest; import com.google.spanner.admin.instance.v1.ListInstanceConfigsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest; +import com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse; import com.google.spanner.admin.instance.v1.ListInstancesRequest; import com.google.spanner.admin.instance.v1.ListInstancesResponse; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigRequest; +import com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest; import com.google.spanner.admin.instance.v1.UpdateInstanceRequest; import io.grpc.stub.StreamObserver; import java.util.ArrayList; @@ -230,6 +239,28 @@ public void listInstances( } } + @Override + public void listInstancePartitions( + ListInstancePartitionsRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListInstancePartitionsResponse) { + requests.add(request); + responseObserver.onNext(((ListInstancePartitionsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListInstancePartitions, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListInstancePartitionsResponse.class.getName(), + Exception.class.getName()))); + } + } + @Override public void getInstance(GetInstanceRequest request, StreamObserver responseObserver) { Object response = responses.poll(); @@ -374,4 +405,110 @@ public void testIamPermissions( Exception.class.getName()))); } } + + @Override + public void getInstancePartition( + GetInstancePartitionRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof InstancePartition) { + requests.add(request); + responseObserver.onNext(((InstancePartition) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetInstancePartition, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + InstancePartition.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void createInstancePartition( + CreateInstancePartitionRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateInstancePartition, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteInstancePartition( + DeleteInstancePartitionRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Empty) { + requests.add(request); + responseObserver.onNext(((Empty) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteInstancePartition, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateInstancePartition( + UpdateInstancePartitionRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateInstancePartition, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listInstancePartitionOperations( + ListInstancePartitionOperationsRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListInstancePartitionOperationsResponse) { + requests.add(request); + responseObserver.onNext(((ListInstancePartitionOperationsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListInstancePartitionOperations, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListInstancePartitionOperationsResponse.class.getName(), + Exception.class.getName()))); + } + } } diff --git a/grpc-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceAdminGrpc.java b/grpc-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceAdminGrpc.java index 400cb20ae90..260460319f2 100644 --- a/grpc-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceAdminGrpc.java +++ b/grpc-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceAdminGrpc.java @@ -393,6 +393,56 @@ private InstanceAdminGrpc() {} return getListInstancesMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest, + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse> + getListInstancePartitionsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListInstancePartitions", + requestType = com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest.class, + responseType = com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest, + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse> + getListInstancePartitionsMethod() { + io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest, + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse> + getListInstancePartitionsMethod; + if ((getListInstancePartitionsMethod = InstanceAdminGrpc.getListInstancePartitionsMethod) + == null) { + synchronized (InstanceAdminGrpc.class) { + if ((getListInstancePartitionsMethod = InstanceAdminGrpc.getListInstancePartitionsMethod) + == null) { + InstanceAdminGrpc.getListInstancePartitionsMethod = + getListInstancePartitionsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "ListInstancePartitions")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new InstanceAdminMethodDescriptorSupplier("ListInstancePartitions")) + .build(); + } + } + } + return getListInstancePartitionsMethod; + } + private static volatile io.grpc.MethodDescriptor< com.google.spanner.admin.instance.v1.GetInstanceRequest, com.google.spanner.admin.instance.v1.Instance> @@ -694,6 +744,258 @@ private InstanceAdminGrpc() {} return getTestIamPermissionsMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest, + com.google.spanner.admin.instance.v1.InstancePartition> + getGetInstancePartitionMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetInstancePartition", + requestType = com.google.spanner.admin.instance.v1.GetInstancePartitionRequest.class, + responseType = com.google.spanner.admin.instance.v1.InstancePartition.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest, + com.google.spanner.admin.instance.v1.InstancePartition> + getGetInstancePartitionMethod() { + io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest, + com.google.spanner.admin.instance.v1.InstancePartition> + getGetInstancePartitionMethod; + if ((getGetInstancePartitionMethod = InstanceAdminGrpc.getGetInstancePartitionMethod) == null) { + synchronized (InstanceAdminGrpc.class) { + if ((getGetInstancePartitionMethod = InstanceAdminGrpc.getGetInstancePartitionMethod) + == null) { + InstanceAdminGrpc.getGetInstancePartitionMethod = + getGetInstancePartitionMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "GetInstancePartition")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.spanner.admin.instance.v1.InstancePartition + .getDefaultInstance())) + .setSchemaDescriptor( + new InstanceAdminMethodDescriptorSupplier("GetInstancePartition")) + .build(); + } + } + } + return getGetInstancePartitionMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest, + com.google.longrunning.Operation> + getCreateInstancePartitionMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateInstancePartition", + requestType = com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest, + com.google.longrunning.Operation> + getCreateInstancePartitionMethod() { + io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest, + com.google.longrunning.Operation> + getCreateInstancePartitionMethod; + if ((getCreateInstancePartitionMethod = InstanceAdminGrpc.getCreateInstancePartitionMethod) + == null) { + synchronized (InstanceAdminGrpc.class) { + if ((getCreateInstancePartitionMethod = InstanceAdminGrpc.getCreateInstancePartitionMethod) + == null) { + InstanceAdminGrpc.getCreateInstancePartitionMethod = + getCreateInstancePartitionMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "CreateInstancePartition")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new InstanceAdminMethodDescriptorSupplier("CreateInstancePartition")) + .build(); + } + } + } + return getCreateInstancePartitionMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest, + com.google.protobuf.Empty> + getDeleteInstancePartitionMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteInstancePartition", + requestType = com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest.class, + responseType = com.google.protobuf.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest, + com.google.protobuf.Empty> + getDeleteInstancePartitionMethod() { + io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest, + com.google.protobuf.Empty> + getDeleteInstancePartitionMethod; + if ((getDeleteInstancePartitionMethod = InstanceAdminGrpc.getDeleteInstancePartitionMethod) + == null) { + synchronized (InstanceAdminGrpc.class) { + if ((getDeleteInstancePartitionMethod = InstanceAdminGrpc.getDeleteInstancePartitionMethod) + == null) { + InstanceAdminGrpc.getDeleteInstancePartitionMethod = + getDeleteInstancePartitionMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "DeleteInstancePartition")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.protobuf.Empty.getDefaultInstance())) + .setSchemaDescriptor( + new InstanceAdminMethodDescriptorSupplier("DeleteInstancePartition")) + .build(); + } + } + } + return getDeleteInstancePartitionMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest, + com.google.longrunning.Operation> + getUpdateInstancePartitionMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateInstancePartition", + requestType = com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest, + com.google.longrunning.Operation> + getUpdateInstancePartitionMethod() { + io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest, + com.google.longrunning.Operation> + getUpdateInstancePartitionMethod; + if ((getUpdateInstancePartitionMethod = InstanceAdminGrpc.getUpdateInstancePartitionMethod) + == null) { + synchronized (InstanceAdminGrpc.class) { + if ((getUpdateInstancePartitionMethod = InstanceAdminGrpc.getUpdateInstancePartitionMethod) + == null) { + InstanceAdminGrpc.getUpdateInstancePartitionMethod = + getUpdateInstancePartitionMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "UpdateInstancePartition")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new InstanceAdminMethodDescriptorSupplier("UpdateInstancePartition")) + .build(); + } + } + } + return getUpdateInstancePartitionMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest, + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse> + getListInstancePartitionOperationsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListInstancePartitionOperations", + requestType = + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.class, + responseType = + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest, + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse> + getListInstancePartitionOperationsMethod() { + io.grpc.MethodDescriptor< + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest, + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse> + getListInstancePartitionOperationsMethod; + if ((getListInstancePartitionOperationsMethod = + InstanceAdminGrpc.getListInstancePartitionOperationsMethod) + == null) { + synchronized (InstanceAdminGrpc.class) { + if ((getListInstancePartitionOperationsMethod = + InstanceAdminGrpc.getListInstancePartitionOperationsMethod) + == null) { + InstanceAdminGrpc.getListInstancePartitionOperationsMethod = + getListInstancePartitionOperationsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "ListInstancePartitionOperations")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.spanner.admin.instance.v1 + .ListInstancePartitionOperationsRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.spanner.admin.instance.v1 + .ListInstancePartitionOperationsResponse.getDefaultInstance())) + .setSchemaDescriptor( + new InstanceAdminMethodDescriptorSupplier( + "ListInstancePartitionOperations")) + .build(); + } + } + } + return getListInstancePartitionOperationsMethod; + } + /** Creates a new async stub that supports all call types for the service */ public static InstanceAdminStub newStub(io.grpc.Channel channel) { io.grpc.stub.AbstractStub.StubFactory factory = @@ -946,6 +1248,22 @@ default void listInstances( getListInstancesMethod(), responseObserver); } + /** + * + * + *

+     * Lists all instance partitions for the given instance.
+     * 
+ */ + default void listInstancePartitions( + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest request, + io.grpc.stub.StreamObserver< + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse> + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListInstancePartitionsMethod(), responseObserver); + } + /** * * @@ -1118,6 +1436,161 @@ default void testIamPermissions( io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( getTestIamPermissionsMethod(), responseObserver); } + + /** + * + * + *
+     * Gets information about a particular instance partition.
+     * 
+ */ + default void getInstancePartition( + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetInstancePartitionMethod(), responseObserver); + } + + /** + * + * + *
+     * Creates an instance partition and begins preparing it to be used. The
+     * returned [long-running operation][google.longrunning.Operation]
+     * can be used to track the progress of preparing the new instance partition.
+     * The instance partition name is assigned by the caller. If the named
+     * instance partition already exists, `CreateInstancePartition` returns
+     * `ALREADY_EXISTS`.
+     * Immediately upon completion of this request:
+     *   * The instance partition is readable via the API, with all requested
+     *     attributes but no allocated resources. Its state is `CREATING`.
+     * Until completion of the returned operation:
+     *   * Cancelling the operation renders the instance partition immediately
+     *     unreadable via the API.
+     *   * The instance partition can be deleted.
+     *   * All other attempts to modify the instance partition are rejected.
+     * Upon completion of the returned operation:
+     *   * Billing for all successfully-allocated resources begins (some types
+     *     may have lower than the requested levels).
+     *   * Databases can start using this instance partition.
+     *   * The instance partition's allocated resource levels are readable via the
+     *     API.
+     *   * The instance partition's state becomes `READY`.
+     * The returned [long-running operation][google.longrunning.Operation] will
+     * have a name of the format
+     * `<instance_partition_name>/operations/<operation_id>` and can be used to
+     * track creation of the instance partition.  The
+     * [metadata][google.longrunning.Operation.metadata] field type is
+     * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
+     * The [response][google.longrunning.Operation.response] field type is
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if
+     * successful.
+     * 
+ */ + default void createInstancePartition( + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateInstancePartitionMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes an existing instance partition. Requires that the
+     * instance partition is not used by any database or backup and is not the
+     * default instance partition of an instance.
+     * Authorization requires `spanner.instancePartitions.delete` permission on
+     * the resource
+     * [name][google.spanner.admin.instance.v1.InstancePartition.name].
+     * 
+ */ + default void deleteInstancePartition( + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteInstancePartitionMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates an instance partition, and begins allocating or releasing resources
+     * as requested. The returned [long-running
+     * operation][google.longrunning.Operation] can be used to track the
+     * progress of updating the instance partition. If the named instance
+     * partition does not exist, returns `NOT_FOUND`.
+     * Immediately upon completion of this request:
+     *   * For resource types for which a decrease in the instance partition's
+     *   allocation has been requested, billing is based on the newly-requested
+     *   level.
+     * Until completion of the returned operation:
+     *   * Cancelling the operation sets its metadata's
+     *     [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time],
+     *     and begins restoring resources to their pre-request values. The
+     *     operation is guaranteed to succeed at undoing all resource changes,
+     *     after which point it terminates with a `CANCELLED` status.
+     *   * All other attempts to modify the instance partition are rejected.
+     *   * Reading the instance partition via the API continues to give the
+     *     pre-request resource levels.
+     * Upon completion of the returned operation:
+     *   * Billing begins for all successfully-allocated resources (some types
+     *     may have lower than the requested levels).
+     *   * All newly-reserved resources are available for serving the instance
+     *     partition's tables.
+     *   * The instance partition's new resource levels are readable via the API.
+     * The returned [long-running operation][google.longrunning.Operation] will
+     * have a name of the format
+     * `<instance_partition_name>/operations/<operation_id>` and can be used to
+     * track the instance partition modification. The
+     * [metadata][google.longrunning.Operation.metadata] field type is
+     * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata].
+     * The [response][google.longrunning.Operation.response] field type is
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if
+     * successful.
+     * Authorization requires `spanner.instancePartitions.update` permission on
+     * the resource
+     * [name][google.spanner.admin.instance.v1.InstancePartition.name].
+     * 
+ */ + default void updateInstancePartition( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateInstancePartitionMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists instance partition [long-running
+     * operations][google.longrunning.Operation] in the given instance.
+     * An instance partition operation has a name of the form
+     * `projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>`.
+     * The long-running operation
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata. Operations returned
+     * include those that have completed/failed/canceled within the last 7 days,
+     * and pending operations. Operations returned are ordered by
+     * `operation.metadata.value.start_time` in descending order starting from the
+     * most recently started operation.
+     * Authorization requires `spanner.instancePartitionOperations.list`
+     * permission on the resource
+     * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent].
+     * 
+ */ + default void listInstancePartitionOperations( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest request, + io.grpc.stub.StreamObserver< + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse> + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListInstancePartitionOperationsMethod(), responseObserver); + } } /** @@ -1387,6 +1860,24 @@ public void listInstances( responseObserver); } + /** + * + * + *
+     * Lists all instance partitions for the given instance.
+     * 
+ */ + public void listInstancePartitions( + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest request, + io.grpc.stub.StreamObserver< + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse> + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListInstancePartitionsMethod(), getCallOptions()), + request, + responseObserver); + } + /** * * @@ -1544,11 +2035,166 @@ public void setIamPolicy( * [resource][google.iam.v1.GetIamPolicyRequest.resource]. * */ - public void getIamPolicy( - com.google.iam.v1.GetIamPolicyRequest request, - io.grpc.stub.StreamObserver responseObserver) { + public void getIamPolicy( + com.google.iam.v1.GetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Returns permissions that the caller has on the specified instance resource.
+     * Attempting this RPC on a non-existent Cloud Spanner instance resource will
+     * result in a NOT_FOUND error if the user has `spanner.instances.list`
+     * permission on the containing Google Cloud Project. Otherwise returns an
+     * empty set of permissions.
+     * 
+ */ + public void testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Gets information about a particular instance partition.
+     * 
+ */ + public void getInstancePartition( + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetInstancePartitionMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Creates an instance partition and begins preparing it to be used. The
+     * returned [long-running operation][google.longrunning.Operation]
+     * can be used to track the progress of preparing the new instance partition.
+     * The instance partition name is assigned by the caller. If the named
+     * instance partition already exists, `CreateInstancePartition` returns
+     * `ALREADY_EXISTS`.
+     * Immediately upon completion of this request:
+     *   * The instance partition is readable via the API, with all requested
+     *     attributes but no allocated resources. Its state is `CREATING`.
+     * Until completion of the returned operation:
+     *   * Cancelling the operation renders the instance partition immediately
+     *     unreadable via the API.
+     *   * The instance partition can be deleted.
+     *   * All other attempts to modify the instance partition are rejected.
+     * Upon completion of the returned operation:
+     *   * Billing for all successfully-allocated resources begins (some types
+     *     may have lower than the requested levels).
+     *   * Databases can start using this instance partition.
+     *   * The instance partition's allocated resource levels are readable via the
+     *     API.
+     *   * The instance partition's state becomes `READY`.
+     * The returned [long-running operation][google.longrunning.Operation] will
+     * have a name of the format
+     * `<instance_partition_name>/operations/<operation_id>` and can be used to
+     * track creation of the instance partition.  The
+     * [metadata][google.longrunning.Operation.metadata] field type is
+     * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
+     * The [response][google.longrunning.Operation.response] field type is
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if
+     * successful.
+     * 
+ */ + public void createInstancePartition( + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateInstancePartitionMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes an existing instance partition. Requires that the
+     * instance partition is not used by any database or backup and is not the
+     * default instance partition of an instance.
+     * Authorization requires `spanner.instancePartitions.delete` permission on
+     * the resource
+     * [name][google.spanner.admin.instance.v1.InstancePartition.name].
+     * 
+ */ + public void deleteInstancePartition( + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteInstancePartitionMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates an instance partition, and begins allocating or releasing resources
+     * as requested. The returned [long-running
+     * operation][google.longrunning.Operation] can be used to track the
+     * progress of updating the instance partition. If the named instance
+     * partition does not exist, returns `NOT_FOUND`.
+     * Immediately upon completion of this request:
+     *   * For resource types for which a decrease in the instance partition's
+     *   allocation has been requested, billing is based on the newly-requested
+     *   level.
+     * Until completion of the returned operation:
+     *   * Cancelling the operation sets its metadata's
+     *     [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time],
+     *     and begins restoring resources to their pre-request values. The
+     *     operation is guaranteed to succeed at undoing all resource changes,
+     *     after which point it terminates with a `CANCELLED` status.
+     *   * All other attempts to modify the instance partition are rejected.
+     *   * Reading the instance partition via the API continues to give the
+     *     pre-request resource levels.
+     * Upon completion of the returned operation:
+     *   * Billing begins for all successfully-allocated resources (some types
+     *     may have lower than the requested levels).
+     *   * All newly-reserved resources are available for serving the instance
+     *     partition's tables.
+     *   * The instance partition's new resource levels are readable via the API.
+     * The returned [long-running operation][google.longrunning.Operation] will
+     * have a name of the format
+     * `<instance_partition_name>/operations/<operation_id>` and can be used to
+     * track the instance partition modification. The
+     * [metadata][google.longrunning.Operation.metadata] field type is
+     * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata].
+     * The [response][google.longrunning.Operation.response] field type is
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if
+     * successful.
+     * Authorization requires `spanner.instancePartitions.update` permission on
+     * the resource
+     * [name][google.spanner.admin.instance.v1.InstancePartition.name].
+     * 
+ */ + public void updateInstancePartition( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest request, + io.grpc.stub.StreamObserver responseObserver) { io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()), + getChannel().newCall(getUpdateInstancePartitionMethod(), getCallOptions()), request, responseObserver); } @@ -1557,19 +2203,29 @@ public void getIamPolicy( * * *
-     * Returns permissions that the caller has on the specified instance resource.
-     * Attempting this RPC on a non-existent Cloud Spanner instance resource will
-     * result in a NOT_FOUND error if the user has `spanner.instances.list`
-     * permission on the containing Google Cloud Project. Otherwise returns an
-     * empty set of permissions.
+     * Lists instance partition [long-running
+     * operations][google.longrunning.Operation] in the given instance.
+     * An instance partition operation has a name of the form
+     * `projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>`.
+     * The long-running operation
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata. Operations returned
+     * include those that have completed/failed/canceled within the last 7 days,
+     * and pending operations. Operations returned are ordered by
+     * `operation.metadata.value.start_time` in descending order starting from the
+     * most recently started operation.
+     * Authorization requires `spanner.instancePartitionOperations.list`
+     * permission on the resource
+     * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent].
      * 
*/ - public void testIamPermissions( - com.google.iam.v1.TestIamPermissionsRequest request, - io.grpc.stub.StreamObserver + public void listInstancePartitionOperations( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest request, + io.grpc.stub.StreamObserver< + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse> responseObserver) { io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), + getChannel().newCall(getListInstancePartitionOperationsMethod(), getCallOptions()), request, responseObserver); } @@ -1784,6 +2440,20 @@ public com.google.spanner.admin.instance.v1.ListInstancesResponse listInstances( getChannel(), getListInstancesMethod(), getCallOptions(), request); } + /** + * + * + *
+     * Lists all instance partitions for the given instance.
+     * 
+ */ + public com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse + listInstancePartitions( + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListInstancePartitionsMethod(), getCallOptions(), request); + } + /** * * @@ -1945,6 +2615,154 @@ public com.google.iam.v1.TestIamPermissionsResponse testIamPermissions( return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getTestIamPermissionsMethod(), getCallOptions(), request); } + + /** + * + * + *
+     * Gets information about a particular instance partition.
+     * 
+ */ + public com.google.spanner.admin.instance.v1.InstancePartition getInstancePartition( + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetInstancePartitionMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Creates an instance partition and begins preparing it to be used. The
+     * returned [long-running operation][google.longrunning.Operation]
+     * can be used to track the progress of preparing the new instance partition.
+     * The instance partition name is assigned by the caller. If the named
+     * instance partition already exists, `CreateInstancePartition` returns
+     * `ALREADY_EXISTS`.
+     * Immediately upon completion of this request:
+     *   * The instance partition is readable via the API, with all requested
+     *     attributes but no allocated resources. Its state is `CREATING`.
+     * Until completion of the returned operation:
+     *   * Cancelling the operation renders the instance partition immediately
+     *     unreadable via the API.
+     *   * The instance partition can be deleted.
+     *   * All other attempts to modify the instance partition are rejected.
+     * Upon completion of the returned operation:
+     *   * Billing for all successfully-allocated resources begins (some types
+     *     may have lower than the requested levels).
+     *   * Databases can start using this instance partition.
+     *   * The instance partition's allocated resource levels are readable via the
+     *     API.
+     *   * The instance partition's state becomes `READY`.
+     * The returned [long-running operation][google.longrunning.Operation] will
+     * have a name of the format
+     * `<instance_partition_name>/operations/<operation_id>` and can be used to
+     * track creation of the instance partition.  The
+     * [metadata][google.longrunning.Operation.metadata] field type is
+     * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
+     * The [response][google.longrunning.Operation.response] field type is
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if
+     * successful.
+     * 
+ */ + public com.google.longrunning.Operation createInstancePartition( + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateInstancePartitionMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes an existing instance partition. Requires that the
+     * instance partition is not used by any database or backup and is not the
+     * default instance partition of an instance.
+     * Authorization requires `spanner.instancePartitions.delete` permission on
+     * the resource
+     * [name][google.spanner.admin.instance.v1.InstancePartition.name].
+     * 
+ */ + public com.google.protobuf.Empty deleteInstancePartition( + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteInstancePartitionMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates an instance partition, and begins allocating or releasing resources
+     * as requested. The returned [long-running
+     * operation][google.longrunning.Operation] can be used to track the
+     * progress of updating the instance partition. If the named instance
+     * partition does not exist, returns `NOT_FOUND`.
+     * Immediately upon completion of this request:
+     *   * For resource types for which a decrease in the instance partition's
+     *   allocation has been requested, billing is based on the newly-requested
+     *   level.
+     * Until completion of the returned operation:
+     *   * Cancelling the operation sets its metadata's
+     *     [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time],
+     *     and begins restoring resources to their pre-request values. The
+     *     operation is guaranteed to succeed at undoing all resource changes,
+     *     after which point it terminates with a `CANCELLED` status.
+     *   * All other attempts to modify the instance partition are rejected.
+     *   * Reading the instance partition via the API continues to give the
+     *     pre-request resource levels.
+     * Upon completion of the returned operation:
+     *   * Billing begins for all successfully-allocated resources (some types
+     *     may have lower than the requested levels).
+     *   * All newly-reserved resources are available for serving the instance
+     *     partition's tables.
+     *   * The instance partition's new resource levels are readable via the API.
+     * The returned [long-running operation][google.longrunning.Operation] will
+     * have a name of the format
+     * `<instance_partition_name>/operations/<operation_id>` and can be used to
+     * track the instance partition modification. The
+     * [metadata][google.longrunning.Operation.metadata] field type is
+     * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata].
+     * The [response][google.longrunning.Operation.response] field type is
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if
+     * successful.
+     * Authorization requires `spanner.instancePartitions.update` permission on
+     * the resource
+     * [name][google.spanner.admin.instance.v1.InstancePartition.name].
+     * 
+ */ + public com.google.longrunning.Operation updateInstancePartition( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateInstancePartitionMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists instance partition [long-running
+     * operations][google.longrunning.Operation] in the given instance.
+     * An instance partition operation has a name of the form
+     * `projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>`.
+     * The long-running operation
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata. Operations returned
+     * include those that have completed/failed/canceled within the last 7 days,
+     * and pending operations. Operations returned are ordered by
+     * `operation.metadata.value.start_time` in descending order starting from the
+     * most recently started operation.
+     * Authorization requires `spanner.instancePartitionOperations.list`
+     * permission on the resource
+     * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent].
+     * 
+ */ + public com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + listInstancePartitionOperations( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListInstancePartitionOperationsMethod(), getCallOptions(), request); + } } /** @@ -2164,6 +2982,21 @@ protected InstanceAdminFutureStub build( getChannel().newCall(getListInstancesMethod(), getCallOptions()), request); } + /** + * + * + *
+     * Lists all instance partitions for the given instance.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse> + listInstancePartitions( + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListInstancePartitionsMethod(), getCallOptions()), request); + } + /** * * @@ -2329,6 +3162,161 @@ protected InstanceAdminFutureStub build( return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), request); } + + /** + * + * + *
+     * Gets information about a particular instance partition.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.spanner.admin.instance.v1.InstancePartition> + getInstancePartition( + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetInstancePartitionMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Creates an instance partition and begins preparing it to be used. The
+     * returned [long-running operation][google.longrunning.Operation]
+     * can be used to track the progress of preparing the new instance partition.
+     * The instance partition name is assigned by the caller. If the named
+     * instance partition already exists, `CreateInstancePartition` returns
+     * `ALREADY_EXISTS`.
+     * Immediately upon completion of this request:
+     *   * The instance partition is readable via the API, with all requested
+     *     attributes but no allocated resources. Its state is `CREATING`.
+     * Until completion of the returned operation:
+     *   * Cancelling the operation renders the instance partition immediately
+     *     unreadable via the API.
+     *   * The instance partition can be deleted.
+     *   * All other attempts to modify the instance partition are rejected.
+     * Upon completion of the returned operation:
+     *   * Billing for all successfully-allocated resources begins (some types
+     *     may have lower than the requested levels).
+     *   * Databases can start using this instance partition.
+     *   * The instance partition's allocated resource levels are readable via the
+     *     API.
+     *   * The instance partition's state becomes `READY`.
+     * The returned [long-running operation][google.longrunning.Operation] will
+     * have a name of the format
+     * `<instance_partition_name>/operations/<operation_id>` and can be used to
+     * track creation of the instance partition.  The
+     * [metadata][google.longrunning.Operation.metadata] field type is
+     * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
+     * The [response][google.longrunning.Operation.response] field type is
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if
+     * successful.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createInstancePartition( + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateInstancePartitionMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes an existing instance partition. Requires that the
+     * instance partition is not used by any database or backup and is not the
+     * default instance partition of an instance.
+     * Authorization requires `spanner.instancePartitions.delete` permission on
+     * the resource
+     * [name][google.spanner.admin.instance.v1.InstancePartition.name].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteInstancePartition( + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteInstancePartitionMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates an instance partition, and begins allocating or releasing resources
+     * as requested. The returned [long-running
+     * operation][google.longrunning.Operation] can be used to track the
+     * progress of updating the instance partition. If the named instance
+     * partition does not exist, returns `NOT_FOUND`.
+     * Immediately upon completion of this request:
+     *   * For resource types for which a decrease in the instance partition's
+     *   allocation has been requested, billing is based on the newly-requested
+     *   level.
+     * Until completion of the returned operation:
+     *   * Cancelling the operation sets its metadata's
+     *     [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time],
+     *     and begins restoring resources to their pre-request values. The
+     *     operation is guaranteed to succeed at undoing all resource changes,
+     *     after which point it terminates with a `CANCELLED` status.
+     *   * All other attempts to modify the instance partition are rejected.
+     *   * Reading the instance partition via the API continues to give the
+     *     pre-request resource levels.
+     * Upon completion of the returned operation:
+     *   * Billing begins for all successfully-allocated resources (some types
+     *     may have lower than the requested levels).
+     *   * All newly-reserved resources are available for serving the instance
+     *     partition's tables.
+     *   * The instance partition's new resource levels are readable via the API.
+     * The returned [long-running operation][google.longrunning.Operation] will
+     * have a name of the format
+     * `<instance_partition_name>/operations/<operation_id>` and can be used to
+     * track the instance partition modification. The
+     * [metadata][google.longrunning.Operation.metadata] field type is
+     * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata].
+     * The [response][google.longrunning.Operation.response] field type is
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if
+     * successful.
+     * Authorization requires `spanner.instancePartitions.update` permission on
+     * the resource
+     * [name][google.spanner.admin.instance.v1.InstancePartition.name].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + updateInstancePartition( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateInstancePartitionMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists instance partition [long-running
+     * operations][google.longrunning.Operation] in the given instance.
+     * An instance partition operation has a name of the form
+     * `projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>`.
+     * The long-running operation
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata. Operations returned
+     * include those that have completed/failed/canceled within the last 7 days,
+     * and pending operations. Operations returned are ordered by
+     * `operation.metadata.value.start_time` in descending order starting from the
+     * most recently started operation.
+     * Authorization requires `spanner.instancePartitionOperations.list`
+     * permission on the resource
+     * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse> + listInstancePartitionOperations( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListInstancePartitionOperationsMethod(), getCallOptions()), + request); + } } private static final int METHODID_LIST_INSTANCE_CONFIGS = 0; @@ -2338,13 +3326,19 @@ protected InstanceAdminFutureStub build( private static final int METHODID_DELETE_INSTANCE_CONFIG = 4; private static final int METHODID_LIST_INSTANCE_CONFIG_OPERATIONS = 5; private static final int METHODID_LIST_INSTANCES = 6; - private static final int METHODID_GET_INSTANCE = 7; - private static final int METHODID_CREATE_INSTANCE = 8; - private static final int METHODID_UPDATE_INSTANCE = 9; - private static final int METHODID_DELETE_INSTANCE = 10; - private static final int METHODID_SET_IAM_POLICY = 11; - private static final int METHODID_GET_IAM_POLICY = 12; - private static final int METHODID_TEST_IAM_PERMISSIONS = 13; + private static final int METHODID_LIST_INSTANCE_PARTITIONS = 7; + private static final int METHODID_GET_INSTANCE = 8; + private static final int METHODID_CREATE_INSTANCE = 9; + private static final int METHODID_UPDATE_INSTANCE = 10; + private static final int METHODID_DELETE_INSTANCE = 11; + private static final int METHODID_SET_IAM_POLICY = 12; + private static final int METHODID_GET_IAM_POLICY = 13; + private static final int METHODID_TEST_IAM_PERMISSIONS = 14; + private static final int METHODID_GET_INSTANCE_PARTITION = 15; + private static final int METHODID_CREATE_INSTANCE_PARTITION = 16; + private static final int METHODID_DELETE_INSTANCE_PARTITION = 17; + private static final int METHODID_UPDATE_INSTANCE_PARTITION = 18; + private static final int METHODID_LIST_INSTANCE_PARTITION_OPERATIONS = 19; private static final class MethodHandlers implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -2405,6 +3399,13 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv com.google.spanner.admin.instance.v1.ListInstancesResponse>) responseObserver); break; + case METHODID_LIST_INSTANCE_PARTITIONS: + serviceImpl.listInstancePartitions( + (com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest) request, + (io.grpc.stub.StreamObserver< + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse>) + responseObserver); + break; case METHODID_GET_INSTANCE: serviceImpl.getInstance( (com.google.spanner.admin.instance.v1.GetInstanceRequest) request, @@ -2442,6 +3443,34 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_GET_INSTANCE_PARTITION: + serviceImpl.getInstancePartition( + (com.google.spanner.admin.instance.v1.GetInstancePartitionRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_CREATE_INSTANCE_PARTITION: + serviceImpl.createInstancePartition( + (com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_INSTANCE_PARTITION: + serviceImpl.deleteInstancePartition( + (com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_INSTANCE_PARTITION: + serviceImpl.updateInstancePartition( + (com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_INSTANCE_PARTITION_OPERATIONS: + serviceImpl.listInstancePartitionOperations( + (com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest) request, + (io.grpc.stub.StreamObserver< + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse>) + responseObserver); + break; default: throw new AssertionError(); } @@ -2506,6 +3535,13 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser com.google.spanner.admin.instance.v1.ListInstancesRequest, com.google.spanner.admin.instance.v1.ListInstancesResponse>( service, METHODID_LIST_INSTANCES))) + .addMethod( + getListInstancePartitionsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest, + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse>( + service, METHODID_LIST_INSTANCE_PARTITIONS))) .addMethod( getGetInstanceMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -2547,6 +3583,38 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser com.google.iam.v1.TestIamPermissionsRequest, com.google.iam.v1.TestIamPermissionsResponse>( service, METHODID_TEST_IAM_PERMISSIONS))) + .addMethod( + getGetInstancePartitionMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest, + com.google.spanner.admin.instance.v1.InstancePartition>( + service, METHODID_GET_INSTANCE_PARTITION))) + .addMethod( + getCreateInstancePartitionMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest, + com.google.longrunning.Operation>(service, METHODID_CREATE_INSTANCE_PARTITION))) + .addMethod( + getDeleteInstancePartitionMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest, + com.google.protobuf.Empty>(service, METHODID_DELETE_INSTANCE_PARTITION))) + .addMethod( + getUpdateInstancePartitionMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest, + com.google.longrunning.Operation>(service, METHODID_UPDATE_INSTANCE_PARTITION))) + .addMethod( + getListInstancePartitionOperationsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest, + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse>( + service, METHODID_LIST_INSTANCE_PARTITION_OPERATIONS))) .build(); } @@ -2605,6 +3673,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getDeleteInstanceConfigMethod()) .addMethod(getListInstanceConfigOperationsMethod()) .addMethod(getListInstancesMethod()) + .addMethod(getListInstancePartitionsMethod()) .addMethod(getGetInstanceMethod()) .addMethod(getCreateInstanceMethod()) .addMethod(getUpdateInstanceMethod()) @@ -2612,6 +3681,11 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getSetIamPolicyMethod()) .addMethod(getGetIamPolicyMethod()) .addMethod(getTestIamPermissionsMethod()) + .addMethod(getGetInstancePartitionMethod()) + .addMethod(getCreateInstancePartitionMethod()) + .addMethod(getDeleteInstancePartitionMethod()) + .addMethod(getUpdateInstancePartitionMethod()) + .addMethod(getListInstancePartitionOperationsMethod()) .build(); } } diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionMetadata.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionMetadata.java new file mode 100644 index 00000000000..1e2431b6ae3 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionMetadata.java @@ -0,0 +1,1579 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +/** + * + * + *
+ * Metadata type for the operation returned by
+ * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition].
+ * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.CreateInstancePartitionMetadata} + */ +public final class CreateInstancePartitionMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + CreateInstancePartitionMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateInstancePartitionMetadata.newBuilder() to construct. + private CreateInstancePartitionMetadata( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateInstancePartitionMetadata() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateInstancePartitionMetadata(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata.class, + com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata.Builder.class); + } + + private int bitField0_; + public static final int INSTANCE_PARTITION_FIELD_NUMBER = 1; + private com.google.spanner.admin.instance.v1.InstancePartition instancePartition_; + /** + * + * + *
+   * The instance partition being created.
+   * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * + * @return Whether the instancePartition field is set. + */ + @java.lang.Override + public boolean hasInstancePartition() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * The instance partition being created.
+   * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * + * @return The instancePartition. + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartition getInstancePartition() { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } + /** + * + * + *
+   * The instance partition being created.
+   * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder + getInstancePartitionOrBuilder() { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } + + public static final int START_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp startTime_; + /** + * + * + *
+   * The time at which the
+   * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+   * request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return Whether the startTime field is set. + */ + @java.lang.Override + public boolean hasStartTime() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * The time at which the
+   * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+   * request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return The startTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getStartTime() { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + /** + * + * + *
+   * The time at which the
+   * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+   * request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + + public static final int CANCEL_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp cancelTime_; + /** + * + * + *
+   * The time at which this operation was cancelled. If set, this operation is
+   * in the process of undoing itself (which is guaranteed to succeed) and
+   * cannot be cancelled again.
+   * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + * + * @return Whether the cancelTime field is set. + */ + @java.lang.Override + public boolean hasCancelTime() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+   * The time at which this operation was cancelled. If set, this operation is
+   * in the process of undoing itself (which is guaranteed to succeed) and
+   * cannot be cancelled again.
+   * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + * + * @return The cancelTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCancelTime() { + return cancelTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : cancelTime_; + } + /** + * + * + *
+   * The time at which this operation was cancelled. If set, this operation is
+   * in the process of undoing itself (which is guaranteed to succeed) and
+   * cannot be cancelled again.
+   * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCancelTimeOrBuilder() { + return cancelTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : cancelTime_; + } + + public static final int END_TIME_FIELD_NUMBER = 4; + private com.google.protobuf.Timestamp endTime_; + /** + * + * + *
+   * The time at which this operation failed or was completed successfully.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4; + * + * @return Whether the endTime field is set. + */ + @java.lang.Override + public boolean hasEndTime() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+   * The time at which this operation failed or was completed successfully.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4; + * + * @return The endTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getEndTime() { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + /** + * + * + *
+   * The time at which this operation failed or was completed successfully.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getInstancePartition()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(2, getStartTime()); + } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(3, getCancelTime()); + } + if (((bitField0_ & 0x00000008) != 0)) { + output.writeMessage(4, getEndTime()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getInstancePartition()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getStartTime()); + } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getCancelTime()); + } + if (((bitField0_ & 0x00000008) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getEndTime()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata other = + (com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) obj; + + if (hasInstancePartition() != other.hasInstancePartition()) return false; + if (hasInstancePartition()) { + if (!getInstancePartition().equals(other.getInstancePartition())) return false; + } + if (hasStartTime() != other.hasStartTime()) return false; + if (hasStartTime()) { + if (!getStartTime().equals(other.getStartTime())) return false; + } + if (hasCancelTime() != other.hasCancelTime()) return false; + if (hasCancelTime()) { + if (!getCancelTime().equals(other.getCancelTime())) return false; + } + if (hasEndTime() != other.hasEndTime()) return false; + if (hasEndTime()) { + if (!getEndTime().equals(other.getEndTime())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasInstancePartition()) { + hash = (37 * hash) + INSTANCE_PARTITION_FIELD_NUMBER; + hash = (53 * hash) + getInstancePartition().hashCode(); + } + if (hasStartTime()) { + hash = (37 * hash) + START_TIME_FIELD_NUMBER; + hash = (53 * hash) + getStartTime().hashCode(); + } + if (hasCancelTime()) { + hash = (37 * hash) + CANCEL_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCancelTime().hashCode(); + } + if (hasEndTime()) { + hash = (37 * hash) + END_TIME_FIELD_NUMBER; + hash = (53 * hash) + getEndTime().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Metadata type for the operation returned by
+   * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition].
+   * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.CreateInstancePartitionMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata.class, + com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata.Builder.class); + } + + // Construct using + // com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getInstancePartitionFieldBuilder(); + getStartTimeFieldBuilder(); + getCancelTimeFieldBuilder(); + getEndTimeFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + instancePartition_ = null; + if (instancePartitionBuilder_ != null) { + instancePartitionBuilder_.dispose(); + instancePartitionBuilder_ = null; + } + startTime_ = null; + if (startTimeBuilder_ != null) { + startTimeBuilder_.dispose(); + startTimeBuilder_ = null; + } + cancelTime_ = null; + if (cancelTimeBuilder_ != null) { + cancelTimeBuilder_.dispose(); + cancelTimeBuilder_ = null; + } + endTime_ = null; + if (endTimeBuilder_ != null) { + endTimeBuilder_.dispose(); + endTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionMetadata_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata + getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata build() { + com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata buildPartial() { + com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata result = + new com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.instancePartition_ = + instancePartitionBuilder_ == null + ? instancePartition_ + : instancePartitionBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.startTime_ = startTimeBuilder_ == null ? startTime_ : startTimeBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.cancelTime_ = cancelTimeBuilder_ == null ? cancelTime_ : cancelTimeBuilder_.build(); + to_bitField0_ |= 0x00000004; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.endTime_ = endTimeBuilder_ == null ? endTime_ : endTimeBuilder_.build(); + to_bitField0_ |= 0x00000008; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) { + return mergeFrom( + (com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata other) { + if (other + == com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata + .getDefaultInstance()) return this; + if (other.hasInstancePartition()) { + mergeInstancePartition(other.getInstancePartition()); + } + if (other.hasStartTime()) { + mergeStartTime(other.getStartTime()); + } + if (other.hasCancelTime()) { + mergeCancelTime(other.getCancelTime()); + } + if (other.hasEndTime()) { + mergeEndTime(other.getEndTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + getInstancePartitionFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(getStartTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage(getCancelTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + input.readMessage(getEndTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.spanner.admin.instance.v1.InstancePartition instancePartition_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder> + instancePartitionBuilder_; + /** + * + * + *
+     * The instance partition being created.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * + * @return Whether the instancePartition field is set. + */ + public boolean hasInstancePartition() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * The instance partition being created.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * + * @return The instancePartition. + */ + public com.google.spanner.admin.instance.v1.InstancePartition getInstancePartition() { + if (instancePartitionBuilder_ == null) { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } else { + return instancePartitionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The instance partition being created.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + public Builder setInstancePartition( + com.google.spanner.admin.instance.v1.InstancePartition value) { + if (instancePartitionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + instancePartition_ = value; + } else { + instancePartitionBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The instance partition being created.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + public Builder setInstancePartition( + com.google.spanner.admin.instance.v1.InstancePartition.Builder builderForValue) { + if (instancePartitionBuilder_ == null) { + instancePartition_ = builderForValue.build(); + } else { + instancePartitionBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The instance partition being created.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + public Builder mergeInstancePartition( + com.google.spanner.admin.instance.v1.InstancePartition value) { + if (instancePartitionBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && instancePartition_ != null + && instancePartition_ + != com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance()) { + getInstancePartitionBuilder().mergeFrom(value); + } else { + instancePartition_ = value; + } + } else { + instancePartitionBuilder_.mergeFrom(value); + } + if (instancePartition_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The instance partition being created.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + public Builder clearInstancePartition() { + bitField0_ = (bitField0_ & ~0x00000001); + instancePartition_ = null; + if (instancePartitionBuilder_ != null) { + instancePartitionBuilder_.dispose(); + instancePartitionBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The instance partition being created.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + public com.google.spanner.admin.instance.v1.InstancePartition.Builder + getInstancePartitionBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getInstancePartitionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The instance partition being created.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + public com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder + getInstancePartitionOrBuilder() { + if (instancePartitionBuilder_ != null) { + return instancePartitionBuilder_.getMessageOrBuilder(); + } else { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } + } + /** + * + * + *
+     * The instance partition being created.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder> + getInstancePartitionFieldBuilder() { + if (instancePartitionBuilder_ == null) { + instancePartitionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder>( + getInstancePartition(), getParentForChildren(), isClean()); + instancePartition_ = null; + } + return instancePartitionBuilder_; + } + + private com.google.protobuf.Timestamp startTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + startTimeBuilder_; + /** + * + * + *
+     * The time at which the
+     * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return Whether the startTime field is set. + */ + public boolean hasStartTime() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * The time at which the
+     * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return The startTime. + */ + public com.google.protobuf.Timestamp getStartTime() { + if (startTimeBuilder_ == null) { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } else { + return startTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time at which the
+     * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public Builder setStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + startTime_ = value; + } else { + startTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which the
+     * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public Builder setStartTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (startTimeBuilder_ == null) { + startTime_ = builderForValue.build(); + } else { + startTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which the
+     * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public Builder mergeStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && startTime_ != null + && startTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getStartTimeBuilder().mergeFrom(value); + } else { + startTime_ = value; + } + } else { + startTimeBuilder_.mergeFrom(value); + } + if (startTime_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The time at which the
+     * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public Builder clearStartTime() { + bitField0_ = (bitField0_ & ~0x00000002); + startTime_ = null; + if (startTimeBuilder_ != null) { + startTimeBuilder_.dispose(); + startTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which the
+     * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public com.google.protobuf.Timestamp.Builder getStartTimeBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getStartTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time at which the
+     * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + if (startTimeBuilder_ != null) { + return startTimeBuilder_.getMessageOrBuilder(); + } else { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + } + /** + * + * + *
+     * The time at which the
+     * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getStartTimeFieldBuilder() { + if (startTimeBuilder_ == null) { + startTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getStartTime(), getParentForChildren(), isClean()); + startTime_ = null; + } + return startTimeBuilder_; + } + + private com.google.protobuf.Timestamp cancelTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + cancelTimeBuilder_; + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + * + * @return Whether the cancelTime field is set. + */ + public boolean hasCancelTime() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + * + * @return The cancelTime. + */ + public com.google.protobuf.Timestamp getCancelTime() { + if (cancelTimeBuilder_ == null) { + return cancelTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : cancelTime_; + } else { + return cancelTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + public Builder setCancelTime(com.google.protobuf.Timestamp value) { + if (cancelTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + cancelTime_ = value; + } else { + cancelTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + public Builder setCancelTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (cancelTimeBuilder_ == null) { + cancelTime_ = builderForValue.build(); + } else { + cancelTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + public Builder mergeCancelTime(com.google.protobuf.Timestamp value) { + if (cancelTimeBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && cancelTime_ != null + && cancelTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getCancelTimeBuilder().mergeFrom(value); + } else { + cancelTime_ = value; + } + } else { + cancelTimeBuilder_.mergeFrom(value); + } + if (cancelTime_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + public Builder clearCancelTime() { + bitField0_ = (bitField0_ & ~0x00000004); + cancelTime_ = null; + if (cancelTimeBuilder_ != null) { + cancelTimeBuilder_.dispose(); + cancelTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + public com.google.protobuf.Timestamp.Builder getCancelTimeBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getCancelTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getCancelTimeOrBuilder() { + if (cancelTimeBuilder_ != null) { + return cancelTimeBuilder_.getMessageOrBuilder(); + } else { + return cancelTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : cancelTime_; + } + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCancelTimeFieldBuilder() { + if (cancelTimeBuilder_ == null) { + cancelTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCancelTime(), getParentForChildren(), isClean()); + cancelTime_ = null; + } + return cancelTimeBuilder_; + } + + private com.google.protobuf.Timestamp endTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + endTimeBuilder_; + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + * + * @return Whether the endTime field is set. + */ + public boolean hasEndTime() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + * + * @return The endTime. + */ + public com.google.protobuf.Timestamp getEndTime() { + if (endTimeBuilder_ == null) { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } else { + return endTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + public Builder setEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + endTime_ = value; + } else { + endTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + public Builder setEndTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (endTimeBuilder_ == null) { + endTime_ = builderForValue.build(); + } else { + endTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + public Builder mergeEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) + && endTime_ != null + && endTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getEndTimeBuilder().mergeFrom(value); + } else { + endTime_ = value; + } + } else { + endTimeBuilder_.mergeFrom(value); + } + if (endTime_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + public Builder clearEndTime() { + bitField0_ = (bitField0_ & ~0x00000008); + endTime_ = null; + if (endTimeBuilder_ != null) { + endTimeBuilder_.dispose(); + endTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + public com.google.protobuf.Timestamp.Builder getEndTimeBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getEndTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + if (endTimeBuilder_ != null) { + return endTimeBuilder_.getMessageOrBuilder(); + } else { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getEndTimeFieldBuilder() { + if (endTimeBuilder_ == null) { + endTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getEndTime(), getParentForChildren(), isClean()); + endTime_ = null; + } + return endTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + private static final com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata(); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateInstancePartitionMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionMetadataOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionMetadataOrBuilder.java new file mode 100644 index 00000000000..f29d343bb48 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionMetadataOrBuilder.java @@ -0,0 +1,178 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +public interface CreateInstancePartitionMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The instance partition being created.
+   * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * + * @return Whether the instancePartition field is set. + */ + boolean hasInstancePartition(); + /** + * + * + *
+   * The instance partition being created.
+   * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * + * @return The instancePartition. + */ + com.google.spanner.admin.instance.v1.InstancePartition getInstancePartition(); + /** + * + * + *
+   * The instance partition being created.
+   * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder getInstancePartitionOrBuilder(); + + /** + * + * + *
+   * The time at which the
+   * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+   * request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return Whether the startTime field is set. + */ + boolean hasStartTime(); + /** + * + * + *
+   * The time at which the
+   * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+   * request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return The startTime. + */ + com.google.protobuf.Timestamp getStartTime(); + /** + * + * + *
+   * The time at which the
+   * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
+   * request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder(); + + /** + * + * + *
+   * The time at which this operation was cancelled. If set, this operation is
+   * in the process of undoing itself (which is guaranteed to succeed) and
+   * cannot be cancelled again.
+   * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + * + * @return Whether the cancelTime field is set. + */ + boolean hasCancelTime(); + /** + * + * + *
+   * The time at which this operation was cancelled. If set, this operation is
+   * in the process of undoing itself (which is guaranteed to succeed) and
+   * cannot be cancelled again.
+   * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + * + * @return The cancelTime. + */ + com.google.protobuf.Timestamp getCancelTime(); + /** + * + * + *
+   * The time at which this operation was cancelled. If set, this operation is
+   * in the process of undoing itself (which is guaranteed to succeed) and
+   * cannot be cancelled again.
+   * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + com.google.protobuf.TimestampOrBuilder getCancelTimeOrBuilder(); + + /** + * + * + *
+   * The time at which this operation failed or was completed successfully.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4; + * + * @return Whether the endTime field is set. + */ + boolean hasEndTime(); + /** + * + * + *
+   * The time at which this operation failed or was completed successfully.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4; + * + * @return The endTime. + */ + com.google.protobuf.Timestamp getEndTime(); + /** + * + * + *
+   * The time at which this operation failed or was completed successfully.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder(); +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionRequest.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionRequest.java new file mode 100644 index 00000000000..636a12c5ce9 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionRequest.java @@ -0,0 +1,1202 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +/** + * + * + *
+ * The request for
+ * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition].
+ * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.CreateInstancePartitionRequest} + */ +public final class CreateInstancePartitionRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.CreateInstancePartitionRequest) + CreateInstancePartitionRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateInstancePartitionRequest.newBuilder() to construct. + private CreateInstancePartitionRequest( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateInstancePartitionRequest() { + parent_ = ""; + instancePartitionId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateInstancePartitionRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest.class, + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest.Builder.class); + } + + private int bitField0_; + public static final int PARENT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + * + * + *
+   * Required. The name of the instance in which to create the instance
+   * partition. Values are of the form
+   * `projects/<project>/instances/<instance>`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + 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(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the instance in which to create the instance
+   * partition. Values are of the form
+   * `projects/<project>/instances/<instance>`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INSTANCE_PARTITION_ID_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object instancePartitionId_ = ""; + /** + * + * + *
+   * Required. The ID of the instance partition to create. Valid identifiers are
+   * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
+   * characters in length.
+   * 
+ * + * string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The instancePartitionId. + */ + @java.lang.Override + public java.lang.String getInstancePartitionId() { + java.lang.Object ref = instancePartitionId_; + 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(); + instancePartitionId_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The ID of the instance partition to create. Valid identifiers are
+   * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
+   * characters in length.
+   * 
+ * + * string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for instancePartitionId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getInstancePartitionIdBytes() { + java.lang.Object ref = instancePartitionId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + instancePartitionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INSTANCE_PARTITION_FIELD_NUMBER = 3; + private com.google.spanner.admin.instance.v1.InstancePartition instancePartition_; + /** + * + * + *
+   * Required. The instance partition to create. The instance_partition.name may
+   * be omitted, but if specified must be
+   * `<parent>/instancePartitions/<instance_partition_id>`.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the instancePartition field is set. + */ + @java.lang.Override + public boolean hasInstancePartition() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Required. The instance partition to create. The instance_partition.name may
+   * be omitted, but if specified must be
+   * `<parent>/instancePartitions/<instance_partition_id>`.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The instancePartition. + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartition getInstancePartition() { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } + /** + * + * + *
+   * Required. The instance partition to create. The instance_partition.name may
+   * be omitted, but if specified must be
+   * `<parent>/instancePartitions/<instance_partition_id>`.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder + getInstancePartitionOrBuilder() { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(instancePartitionId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, instancePartitionId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getInstancePartition()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(instancePartitionId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, instancePartitionId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getInstancePartition()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest other = + (com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (!getInstancePartitionId().equals(other.getInstancePartitionId())) return false; + if (hasInstancePartition() != other.hasInstancePartition()) return false; + if (hasInstancePartition()) { + if (!getInstancePartition().equals(other.getInstancePartition())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + INSTANCE_PARTITION_ID_FIELD_NUMBER; + hash = (53 * hash) + getInstancePartitionId().hashCode(); + if (hasInstancePartition()) { + hash = (37 * hash) + INSTANCE_PARTITION_FIELD_NUMBER; + hash = (53 * hash) + getInstancePartition().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request for
+   * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition].
+   * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.CreateInstancePartitionRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.CreateInstancePartitionRequest) + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest.class, + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest.Builder.class); + } + + // Construct using + // com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getInstancePartitionFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + instancePartitionId_ = ""; + instancePartition_ = null; + if (instancePartitionBuilder_ != null) { + instancePartitionBuilder_.dispose(); + instancePartitionBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionRequest_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest + getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest build() { + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest buildPartial() { + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest result = + new com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.instancePartitionId_ = instancePartitionId_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.instancePartition_ = + instancePartitionBuilder_ == null + ? instancePartition_ + : instancePartitionBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest) { + return mergeFrom( + (com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest other) { + if (other + == com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest + .getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getInstancePartitionId().isEmpty()) { + instancePartitionId_ = other.instancePartitionId_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasInstancePartition()) { + mergeInstancePartition(other.getInstancePartition()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + instancePartitionId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage( + getInstancePartitionFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The name of the instance in which to create the instance
+     * partition. Values are of the form
+     * `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the instance in which to create the instance
+     * partition. Values are of the form
+     * `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the instance in which to create the instance
+     * partition. Values are of the form
+     * `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the instance in which to create the instance
+     * partition. Values are of the form
+     * `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the instance in which to create the instance
+     * partition. Values are of the form
+     * `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object instancePartitionId_ = ""; + /** + * + * + *
+     * Required. The ID of the instance partition to create. Valid identifiers are
+     * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
+     * characters in length.
+     * 
+ * + * string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The instancePartitionId. + */ + public java.lang.String getInstancePartitionId() { + java.lang.Object ref = instancePartitionId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + instancePartitionId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The ID of the instance partition to create. Valid identifiers are
+     * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
+     * characters in length.
+     * 
+ * + * string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for instancePartitionId. + */ + public com.google.protobuf.ByteString getInstancePartitionIdBytes() { + java.lang.Object ref = instancePartitionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + instancePartitionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The ID of the instance partition to create. Valid identifiers are
+     * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
+     * characters in length.
+     * 
+ * + * string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The instancePartitionId to set. + * @return This builder for chaining. + */ + public Builder setInstancePartitionId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + instancePartitionId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ID of the instance partition to create. Valid identifiers are
+     * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
+     * characters in length.
+     * 
+ * + * string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearInstancePartitionId() { + instancePartitionId_ = getDefaultInstance().getInstancePartitionId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ID of the instance partition to create. Valid identifiers are
+     * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
+     * characters in length.
+     * 
+ * + * string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for instancePartitionId to set. + * @return This builder for chaining. + */ + public Builder setInstancePartitionIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + instancePartitionId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.spanner.admin.instance.v1.InstancePartition instancePartition_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder> + instancePartitionBuilder_; + /** + * + * + *
+     * Required. The instance partition to create. The instance_partition.name may
+     * be omitted, but if specified must be
+     * `<parent>/instancePartitions/<instance_partition_id>`.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the instancePartition field is set. + */ + public boolean hasInstancePartition() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * Required. The instance partition to create. The instance_partition.name may
+     * be omitted, but if specified must be
+     * `<parent>/instancePartitions/<instance_partition_id>`.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The instancePartition. + */ + public com.google.spanner.admin.instance.v1.InstancePartition getInstancePartition() { + if (instancePartitionBuilder_ == null) { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } else { + return instancePartitionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The instance partition to create. The instance_partition.name may
+     * be omitted, but if specified must be
+     * `<parent>/instancePartitions/<instance_partition_id>`.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setInstancePartition( + com.google.spanner.admin.instance.v1.InstancePartition value) { + if (instancePartitionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + instancePartition_ = value; + } else { + instancePartitionBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The instance partition to create. The instance_partition.name may
+     * be omitted, but if specified must be
+     * `<parent>/instancePartitions/<instance_partition_id>`.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setInstancePartition( + com.google.spanner.admin.instance.v1.InstancePartition.Builder builderForValue) { + if (instancePartitionBuilder_ == null) { + instancePartition_ = builderForValue.build(); + } else { + instancePartitionBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The instance partition to create. The instance_partition.name may
+     * be omitted, but if specified must be
+     * `<parent>/instancePartitions/<instance_partition_id>`.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeInstancePartition( + com.google.spanner.admin.instance.v1.InstancePartition value) { + if (instancePartitionBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && instancePartition_ != null + && instancePartition_ + != com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance()) { + getInstancePartitionBuilder().mergeFrom(value); + } else { + instancePartition_ = value; + } + } else { + instancePartitionBuilder_.mergeFrom(value); + } + if (instancePartition_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Required. The instance partition to create. The instance_partition.name may
+     * be omitted, but if specified must be
+     * `<parent>/instancePartitions/<instance_partition_id>`.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearInstancePartition() { + bitField0_ = (bitField0_ & ~0x00000004); + instancePartition_ = null; + if (instancePartitionBuilder_ != null) { + instancePartitionBuilder_.dispose(); + instancePartitionBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The instance partition to create. The instance_partition.name may
+     * be omitted, but if specified must be
+     * `<parent>/instancePartitions/<instance_partition_id>`.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.spanner.admin.instance.v1.InstancePartition.Builder + getInstancePartitionBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getInstancePartitionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The instance partition to create. The instance_partition.name may
+     * be omitted, but if specified must be
+     * `<parent>/instancePartitions/<instance_partition_id>`.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder + getInstancePartitionOrBuilder() { + if (instancePartitionBuilder_ != null) { + return instancePartitionBuilder_.getMessageOrBuilder(); + } else { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } + } + /** + * + * + *
+     * Required. The instance partition to create. The instance_partition.name may
+     * be omitted, but if specified must be
+     * `<parent>/instancePartitions/<instance_partition_id>`.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder> + getInstancePartitionFieldBuilder() { + if (instancePartitionBuilder_ == null) { + instancePartitionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder>( + getInstancePartition(), getParentForChildren(), isClean()); + instancePartition_ = null; + } + return instancePartitionBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.CreateInstancePartitionRequest) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.CreateInstancePartitionRequest) + private static final com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest(); + } + + public static com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateInstancePartitionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.CreateInstancePartitionRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionRequestOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionRequestOrBuilder.java new file mode 100644 index 00000000000..fae12b0bfe5 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstancePartitionRequestOrBuilder.java @@ -0,0 +1,135 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +public interface CreateInstancePartitionRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.CreateInstancePartitionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the instance in which to create the instance
+   * partition. Values are of the form
+   * `projects/<project>/instances/<instance>`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The name of the instance in which to create the instance
+   * partition. Values are of the form
+   * `projects/<project>/instances/<instance>`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The ID of the instance partition to create. Valid identifiers are
+   * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
+   * characters in length.
+   * 
+ * + * string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The instancePartitionId. + */ + java.lang.String getInstancePartitionId(); + /** + * + * + *
+   * Required. The ID of the instance partition to create. Valid identifiers are
+   * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
+   * characters in length.
+   * 
+ * + * string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for instancePartitionId. + */ + com.google.protobuf.ByteString getInstancePartitionIdBytes(); + + /** + * + * + *
+   * Required. The instance partition to create. The instance_partition.name may
+   * be omitted, but if specified must be
+   * `<parent>/instancePartitions/<instance_partition_id>`.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the instancePartition field is set. + */ + boolean hasInstancePartition(); + /** + * + * + *
+   * Required. The instance partition to create. The instance_partition.name may
+   * be omitted, but if specified must be
+   * `<parent>/instancePartitions/<instance_partition_id>`.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The instancePartition. + */ + com.google.spanner.admin.instance.v1.InstancePartition getInstancePartition(); + /** + * + * + *
+   * Required. The instance partition to create. The instance_partition.name may
+   * be omitted, but if specified must be
+   * `<parent>/instancePartitions/<instance_partition_id>`.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder getInstancePartitionOrBuilder(); +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/DeleteInstancePartitionRequest.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/DeleteInstancePartitionRequest.java new file mode 100644 index 00000000000..c4186941ca4 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/DeleteInstancePartitionRequest.java @@ -0,0 +1,871 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +/** + * + * + *
+ * The request for
+ * [DeleteInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstancePartition].
+ * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.DeleteInstancePartitionRequest} + */ +public final class DeleteInstancePartitionRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.DeleteInstancePartitionRequest) + DeleteInstancePartitionRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteInstancePartitionRequest.newBuilder() to construct. + private DeleteInstancePartitionRequest( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteInstancePartitionRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteInstancePartitionRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_DeleteInstancePartitionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_DeleteInstancePartitionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest.class, + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Required. The name of the instance partition to be deleted.
+   * Values are of the form
+   * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + 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(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the instance partition to be deleted.
+   * Values are of the form
+   * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ETAG_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object etag_ = ""; + /** + * + * + *
+   * Optional. If not empty, the API only deletes the instance partition when
+   * the etag provided matches the current status of the requested instance
+   * partition. Otherwise, deletes the instance partition without checking the
+   * current status of the requested instance partition.
+   * 
+ * + * string etag = 2; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + 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(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. If not empty, the API only deletes the instance partition when
+   * the etag provided matches the current status of the requested instance
+   * partition. Otherwise, deletes the instance partition without checking the
+   * current status of the requested instance partition.
+   * 
+ * + * string etag = 2; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, etag_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, etag_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest other = + (com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request for
+   * [DeleteInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstancePartition].
+   * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.DeleteInstancePartitionRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.DeleteInstancePartitionRequest) + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_DeleteInstancePartitionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_DeleteInstancePartitionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest.class, + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest.Builder.class); + } + + // Construct using + // com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + etag_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_DeleteInstancePartitionRequest_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest + getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest build() { + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest buildPartial() { + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest result = + new com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.etag_ = etag_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest) { + return mergeFrom( + (com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest other) { + if (other + == com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest + .getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + etag_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the instance partition to be deleted.
+     * Values are of the form
+     * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the instance partition to be deleted.
+     * Values are of the form
+     * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the instance partition to be deleted.
+     * Values are of the form
+     * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the instance partition to be deleted.
+     * Values are of the form
+     * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the instance partition to be deleted.
+     * Values are of the form
+     * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Optional. If not empty, the API only deletes the instance partition when
+     * the etag provided matches the current status of the requested instance
+     * partition. Otherwise, deletes the instance partition without checking the
+     * current status of the requested instance partition.
+     * 
+ * + * string etag = 2; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. If not empty, the API only deletes the instance partition when
+     * the etag provided matches the current status of the requested instance
+     * partition. Otherwise, deletes the instance partition without checking the
+     * current status of the requested instance partition.
+     * 
+ * + * string etag = 2; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. If not empty, the API only deletes the instance partition when
+     * the etag provided matches the current status of the requested instance
+     * partition. Otherwise, deletes the instance partition without checking the
+     * current status of the requested instance partition.
+     * 
+ * + * string etag = 2; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + etag_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If not empty, the API only deletes the instance partition when
+     * the etag provided matches the current status of the requested instance
+     * partition. Otherwise, deletes the instance partition without checking the
+     * current status of the requested instance partition.
+     * 
+ * + * string etag = 2; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + etag_ = getDefaultInstance().getEtag(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If not empty, the API only deletes the instance partition when
+     * the etag provided matches the current status of the requested instance
+     * partition. Otherwise, deletes the instance partition without checking the
+     * current status of the requested instance partition.
+     * 
+ * + * string etag = 2; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + etag_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.DeleteInstancePartitionRequest) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.DeleteInstancePartitionRequest) + private static final com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest(); + } + + public static com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteInstancePartitionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.DeleteInstancePartitionRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/DeleteInstancePartitionRequestOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/DeleteInstancePartitionRequestOrBuilder.java new file mode 100644 index 00000000000..83b455310a4 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/DeleteInstancePartitionRequestOrBuilder.java @@ -0,0 +1,90 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +public interface DeleteInstancePartitionRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.DeleteInstancePartitionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the instance partition to be deleted.
+   * Values are of the form
+   * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the instance partition to be deleted.
+   * Values are of the form
+   * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Optional. If not empty, the API only deletes the instance partition when
+   * the etag provided matches the current status of the requested instance
+   * partition. Otherwise, deletes the instance partition without checking the
+   * current status of the requested instance partition.
+   * 
+ * + * string etag = 2; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Optional. If not empty, the API only deletes the instance partition when
+   * the etag provided matches the current status of the requested instance
+   * partition. Otherwise, deletes the instance partition without checking the
+   * current status of the requested instance partition.
+   * 
+ * + * string etag = 2; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/GetInstancePartitionRequest.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/GetInstancePartitionRequest.java new file mode 100644 index 00000000000..2181f408aab --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/GetInstancePartitionRequest.java @@ -0,0 +1,663 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +/** + * + * + *
+ * The request for
+ * [GetInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.GetInstancePartition].
+ * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.GetInstancePartitionRequest} + */ +public final class GetInstancePartitionRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.GetInstancePartitionRequest) + GetInstancePartitionRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetInstancePartitionRequest.newBuilder() to construct. + private GetInstancePartitionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetInstancePartitionRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetInstancePartitionRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_GetInstancePartitionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_GetInstancePartitionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest.class, + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Required. The name of the requested instance partition. Values are of
+   * the form
+   * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + 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(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the requested instance partition. Values are of
+   * the form
+   * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @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_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.admin.instance.v1.GetInstancePartitionRequest)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest other = + (com.google.spanner.admin.instance.v1.GetInstancePartitionRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.GetInstancePartitionRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.GetInstancePartitionRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.GetInstancePartitionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.GetInstancePartitionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.GetInstancePartitionRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.GetInstancePartitionRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.GetInstancePartitionRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.GetInstancePartitionRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.GetInstancePartitionRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.GetInstancePartitionRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.GetInstancePartitionRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.GetInstancePartitionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request for
+   * [GetInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.GetInstancePartition].
+   * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.GetInstancePartitionRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.GetInstancePartitionRequest) + com.google.spanner.admin.instance.v1.GetInstancePartitionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_GetInstancePartitionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_GetInstancePartitionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest.class, + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest.Builder.class); + } + + // Construct using com.google.spanner.admin.instance.v1.GetInstancePartitionRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_GetInstancePartitionRequest_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.GetInstancePartitionRequest + getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.GetInstancePartitionRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.GetInstancePartitionRequest build() { + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.GetInstancePartitionRequest buildPartial() { + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest result = + new com.google.spanner.admin.instance.v1.GetInstancePartitionRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.admin.instance.v1.GetInstancePartitionRequest) { + return mergeFrom((com.google.spanner.admin.instance.v1.GetInstancePartitionRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.spanner.admin.instance.v1.GetInstancePartitionRequest other) { + if (other + == com.google.spanner.admin.instance.v1.GetInstancePartitionRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the requested instance partition. Values are of
+     * the form
+     * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the requested instance partition. Values are of
+     * the form
+     * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the requested instance partition. Values are of
+     * the form
+     * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the requested instance partition. Values are of
+     * the form
+     * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the requested instance partition. Values are of
+     * the form
+     * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.GetInstancePartitionRequest) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.GetInstancePartitionRequest) + private static final com.google.spanner.admin.instance.v1.GetInstancePartitionRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.admin.instance.v1.GetInstancePartitionRequest(); + } + + public static com.google.spanner.admin.instance.v1.GetInstancePartitionRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetInstancePartitionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.GetInstancePartitionRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/GetInstancePartitionRequestOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/GetInstancePartitionRequestOrBuilder.java new file mode 100644 index 00000000000..fd816ce8e7a --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/GetInstancePartitionRequestOrBuilder.java @@ -0,0 +1,59 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +public interface GetInstancePartitionRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.GetInstancePartitionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the requested instance partition. Values are of
+   * the form
+   * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the requested instance partition. Values are of
+   * the form
+   * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstancePartition.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstancePartition.java new file mode 100644 index 00000000000..b4ca244120f --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstancePartition.java @@ -0,0 +1,3330 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +/** + * + * + *
+ * An isolated set of Cloud Spanner resources that databases can define
+ * placements on.
+ * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.InstancePartition} + */ +public final class InstancePartition extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.InstancePartition) + InstancePartitionOrBuilder { + private static final long serialVersionUID = 0L; + // Use InstancePartition.newBuilder() to construct. + private InstancePartition(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private InstancePartition() { + name_ = ""; + config_ = ""; + displayName_ = ""; + state_ = 0; + referencingDatabases_ = com.google.protobuf.LazyStringArrayList.emptyList(); + referencingBackups_ = com.google.protobuf.LazyStringArrayList.emptyList(); + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new InstancePartition(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_InstancePartition_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_InstancePartition_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.InstancePartition.class, + com.google.spanner.admin.instance.v1.InstancePartition.Builder.class); + } + + /** + * + * + *
+   * Indicates the current state of the instance partition.
+   * 
+ * + * Protobuf enum {@code google.spanner.admin.instance.v1.InstancePartition.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Not specified.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
+     * The instance partition is still being created. Resources may not be
+     * available yet, and operations such as creating placements using this
+     * instance partition may not work.
+     * 
+ * + * CREATING = 1; + */ + CREATING(1), + /** + * + * + *
+     * The instance partition is fully created and ready to do work such as
+     * creating placements and using in databases.
+     * 
+ * + * READY = 2; + */ + READY(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Not specified.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * The instance partition is still being created. Resources may not be
+     * available yet, and operations such as creating placements using this
+     * instance partition may not work.
+     * 
+ * + * CREATING = 1; + */ + public static final int CREATING_VALUE = 1; + /** + * + * + *
+     * The instance partition is fully created and ready to do work such as
+     * creating placements and using in databases.
+     * 
+ * + * READY = 2; + */ + public static final int READY_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return CREATING; + case 2: + return READY; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.InstancePartition.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.spanner.admin.instance.v1.InstancePartition.State) + } + + private int bitField0_; + private int computeCapacityCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object computeCapacity_; + + public enum ComputeCapacityCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + NODE_COUNT(5), + PROCESSING_UNITS(6), + COMPUTECAPACITY_NOT_SET(0); + private final int value; + + private ComputeCapacityCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ComputeCapacityCase valueOf(int value) { + return forNumber(value); + } + + public static ComputeCapacityCase forNumber(int value) { + switch (value) { + case 5: + return NODE_COUNT; + case 6: + return PROCESSING_UNITS; + case 0: + return COMPUTECAPACITY_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ComputeCapacityCase getComputeCapacityCase() { + return ComputeCapacityCase.forNumber(computeCapacityCase_); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Required. A unique identifier for the instance partition. Values are of the
+   * form
+   * `projects/<project>/instances/<instance>/instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`.
+   * The final segment of the name must be between 2 and 64 characters in
+   * length. An instance partition's name cannot be changed after the instance
+   * partition is created.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + 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(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. A unique identifier for the instance partition. Values are of the
+   * form
+   * `projects/<project>/instances/<instance>/instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`.
+   * The final segment of the name must be between 2 and 64 characters in
+   * length. An instance partition's name cannot be changed after the instance
+   * partition is created.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONFIG_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object config_ = ""; + /** + * + * + *
+   * Required. The name of the instance partition's configuration. Values are of
+   * the form `projects/<project>/instanceConfigs/<configuration>`. See also
+   * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
+   * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
+   * 
+ * + * + * string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The config. + */ + @java.lang.Override + public java.lang.String getConfig() { + java.lang.Object ref = config_; + 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(); + config_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the instance partition's configuration. Values are of
+   * the form `projects/<project>/instanceConfigs/<configuration>`. See also
+   * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
+   * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
+   * 
+ * + * + * string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for config. + */ + @java.lang.Override + public com.google.protobuf.ByteString getConfigBytes() { + java.lang.Object ref = config_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + config_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object displayName_ = ""; + /** + * + * + *
+   * Required. The descriptive name for this instance partition as it appears in
+   * UIs. Must be unique per project and between 4 and 30 characters in length.
+   * 
+ * + * string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The displayName. + */ + @java.lang.Override + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + 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(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The descriptive name for this instance partition as it appears in
+   * UIs. Must be unique per project and between 4 and 30 characters in length.
+   * 
+ * + * string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for displayName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NODE_COUNT_FIELD_NUMBER = 5; + /** + * + * + *
+   * The number of nodes allocated to this instance partition.
+   *
+   * Users can set the node_count field to specify the target number of nodes
+   * allocated to the instance partition.
+   *
+   * This may be zero in API responses for instance partitions that are not
+   * yet in state `READY`.
+   * 
+ * + * int32 node_count = 5; + * + * @return Whether the nodeCount field is set. + */ + @java.lang.Override + public boolean hasNodeCount() { + return computeCapacityCase_ == 5; + } + /** + * + * + *
+   * The number of nodes allocated to this instance partition.
+   *
+   * Users can set the node_count field to specify the target number of nodes
+   * allocated to the instance partition.
+   *
+   * This may be zero in API responses for instance partitions that are not
+   * yet in state `READY`.
+   * 
+ * + * int32 node_count = 5; + * + * @return The nodeCount. + */ + @java.lang.Override + public int getNodeCount() { + if (computeCapacityCase_ == 5) { + return (java.lang.Integer) computeCapacity_; + } + return 0; + } + + public static final int PROCESSING_UNITS_FIELD_NUMBER = 6; + /** + * + * + *
+   * The number of processing units allocated to this instance partition.
+   *
+   * Users can set the processing_units field to specify the target number of
+   * processing units allocated to the instance partition.
+   *
+   * This may be zero in API responses for instance partitions that are not
+   * yet in state `READY`.
+   * 
+ * + * int32 processing_units = 6; + * + * @return Whether the processingUnits field is set. + */ + @java.lang.Override + public boolean hasProcessingUnits() { + return computeCapacityCase_ == 6; + } + /** + * + * + *
+   * The number of processing units allocated to this instance partition.
+   *
+   * Users can set the processing_units field to specify the target number of
+   * processing units allocated to the instance partition.
+   *
+   * This may be zero in API responses for instance partitions that are not
+   * yet in state `READY`.
+   * 
+ * + * int32 processing_units = 6; + * + * @return The processingUnits. + */ + @java.lang.Override + public int getProcessingUnits() { + if (computeCapacityCase_ == 6) { + return (java.lang.Integer) computeCapacity_; + } + return 0; + } + + public static final int STATE_FIELD_NUMBER = 7; + private int state_ = 0; + /** + * + * + *
+   * Output only. The current instance partition state.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+   * Output only. The current instance partition state.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartition.State getState() { + com.google.spanner.admin.instance.v1.InstancePartition.State result = + com.google.spanner.admin.instance.v1.InstancePartition.State.forNumber(state_); + return result == null + ? com.google.spanner.admin.instance.v1.InstancePartition.State.UNRECOGNIZED + : result; + } + + public static final int CREATE_TIME_FIELD_NUMBER = 8; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. The time at which the instance partition was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Output only. The time at which the instance partition was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. The time at which the instance partition was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 9; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Output only. The time at which the instance partition was most recently
+   * updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * Output only. The time at which the instance partition was most recently
+   * updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Output only. The time at which the instance partition was most recently
+   * updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + + public static final int REFERENCING_DATABASES_FIELD_NUMBER = 10; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList referencingDatabases_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + * + * + *
+   * Output only. The names of the databases that reference this
+   * instance partition. Referencing databases should share the parent instance.
+   * The existence of any referencing database prevents the instance partition
+   * from being deleted.
+   * 
+ * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the referencingDatabases. + */ + public com.google.protobuf.ProtocolStringList getReferencingDatabasesList() { + return referencingDatabases_; + } + /** + * + * + *
+   * Output only. The names of the databases that reference this
+   * instance partition. Referencing databases should share the parent instance.
+   * The existence of any referencing database prevents the instance partition
+   * from being deleted.
+   * 
+ * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The count of referencingDatabases. + */ + public int getReferencingDatabasesCount() { + return referencingDatabases_.size(); + } + /** + * + * + *
+   * Output only. The names of the databases that reference this
+   * instance partition. Referencing databases should share the parent instance.
+   * The existence of any referencing database prevents the instance partition
+   * from being deleted.
+   * 
+ * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the element to return. + * @return The referencingDatabases at the given index. + */ + public java.lang.String getReferencingDatabases(int index) { + return referencingDatabases_.get(index); + } + /** + * + * + *
+   * Output only. The names of the databases that reference this
+   * instance partition. Referencing databases should share the parent instance.
+   * The existence of any referencing database prevents the instance partition
+   * from being deleted.
+   * 
+ * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the value to return. + * @return The bytes of the referencingDatabases at the given index. + */ + public com.google.protobuf.ByteString getReferencingDatabasesBytes(int index) { + return referencingDatabases_.getByteString(index); + } + + public static final int REFERENCING_BACKUPS_FIELD_NUMBER = 11; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList referencingBackups_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + * + * + *
+   * Output only. The names of the backups that reference this instance
+   * partition. Referencing backups should share the parent instance. The
+   * existence of any referencing backup prevents the instance partition from
+   * being deleted.
+   * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the referencingBackups. + */ + public com.google.protobuf.ProtocolStringList getReferencingBackupsList() { + return referencingBackups_; + } + /** + * + * + *
+   * Output only. The names of the backups that reference this instance
+   * partition. Referencing backups should share the parent instance. The
+   * existence of any referencing backup prevents the instance partition from
+   * being deleted.
+   * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The count of referencingBackups. + */ + public int getReferencingBackupsCount() { + return referencingBackups_.size(); + } + /** + * + * + *
+   * Output only. The names of the backups that reference this instance
+   * partition. Referencing backups should share the parent instance. The
+   * existence of any referencing backup prevents the instance partition from
+   * being deleted.
+   * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the element to return. + * @return The referencingBackups at the given index. + */ + public java.lang.String getReferencingBackups(int index) { + return referencingBackups_.get(index); + } + /** + * + * + *
+   * Output only. The names of the backups that reference this instance
+   * partition. Referencing backups should share the parent instance. The
+   * existence of any referencing backup prevents the instance partition from
+   * being deleted.
+   * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the value to return. + * @return The bytes of the referencingBackups at the given index. + */ + public com.google.protobuf.ByteString getReferencingBackupsBytes(int index) { + return referencingBackups_.getByteString(index); + } + + public static final int ETAG_FIELD_NUMBER = 12; + + @SuppressWarnings("serial") + private volatile java.lang.Object etag_ = ""; + /** + * + * + *
+   * Used for optimistic concurrency control as a way
+   * to help prevent simultaneous updates of a instance partition from
+   * overwriting each other. It is strongly suggested that systems make use of
+   * the etag in the read-modify-write cycle to perform instance partition
+   * updates in order to avoid race conditions: An etag is returned in the
+   * response which contains instance partitions, and systems are expected to
+   * put that etag in the request to update instance partitions to ensure that
+   * their change will be applied to the same version of the instance partition.
+   * If no etag is provided in the call to update instance partition, then the
+   * existing instance partition is overwritten blindly.
+   * 
+ * + * string etag = 12; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + 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(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Used for optimistic concurrency control as a way
+   * to help prevent simultaneous updates of a instance partition from
+   * overwriting each other. It is strongly suggested that systems make use of
+   * the etag in the read-modify-write cycle to perform instance partition
+   * updates in order to avoid race conditions: An etag is returned in the
+   * response which contains instance partitions, and systems are expected to
+   * put that etag in the request to update instance partitions to ensure that
+   * their change will be applied to the same version of the instance partition.
+   * If no etag is provided in the call to update instance partition, then the
+   * existing instance partition is overwritten blindly.
+   * 
+ * + * string etag = 12; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(config_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, config_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, displayName_); + } + if (computeCapacityCase_ == 5) { + output.writeInt32(5, (int) ((java.lang.Integer) computeCapacity_)); + } + if (computeCapacityCase_ == 6) { + output.writeInt32(6, (int) ((java.lang.Integer) computeCapacity_)); + } + if (state_ + != com.google.spanner.admin.instance.v1.InstancePartition.State.STATE_UNSPECIFIED + .getNumber()) { + output.writeEnum(7, state_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(8, getCreateTime()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(9, getUpdateTime()); + } + for (int i = 0; i < referencingDatabases_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString( + output, 10, referencingDatabases_.getRaw(i)); + } + for (int i = 0; i < referencingBackups_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 11, referencingBackups_.getRaw(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 12, etag_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(config_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, config_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, displayName_); + } + if (computeCapacityCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeInt32Size( + 5, (int) ((java.lang.Integer) computeCapacity_)); + } + if (computeCapacityCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeInt32Size( + 6, (int) ((java.lang.Integer) computeCapacity_)); + } + if (state_ + != com.google.spanner.admin.instance.v1.InstancePartition.State.STATE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(7, state_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getCreateTime()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getUpdateTime()); + } + { + int dataSize = 0; + for (int i = 0; i < referencingDatabases_.size(); i++) { + dataSize += computeStringSizeNoTag(referencingDatabases_.getRaw(i)); + } + size += dataSize; + size += 1 * getReferencingDatabasesList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < referencingBackups_.size(); i++) { + dataSize += computeStringSizeNoTag(referencingBackups_.getRaw(i)); + } + size += dataSize; + size += 1 * getReferencingBackupsList().size(); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(12, etag_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.admin.instance.v1.InstancePartition)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.InstancePartition other = + (com.google.spanner.admin.instance.v1.InstancePartition) obj; + + if (!getName().equals(other.getName())) return false; + if (!getConfig().equals(other.getConfig())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (state_ != other.state_) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (!getReferencingDatabasesList().equals(other.getReferencingDatabasesList())) return false; + if (!getReferencingBackupsList().equals(other.getReferencingBackupsList())) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!getComputeCapacityCase().equals(other.getComputeCapacityCase())) return false; + switch (computeCapacityCase_) { + case 5: + if (getNodeCount() != other.getNodeCount()) return false; + break; + case 6: + if (getProcessingUnits() != other.getProcessingUnits()) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getConfig().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + if (getReferencingDatabasesCount() > 0) { + hash = (37 * hash) + REFERENCING_DATABASES_FIELD_NUMBER; + hash = (53 * hash) + getReferencingDatabasesList().hashCode(); + } + if (getReferencingBackupsCount() > 0) { + hash = (37 * hash) + REFERENCING_BACKUPS_FIELD_NUMBER; + hash = (53 * hash) + getReferencingBackupsList().hashCode(); + } + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + switch (computeCapacityCase_) { + case 5: + hash = (37 * hash) + NODE_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getNodeCount(); + break; + case 6: + hash = (37 * hash) + PROCESSING_UNITS_FIELD_NUMBER; + hash = (53 * hash) + getProcessingUnits(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.InstancePartition parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.InstancePartition parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.InstancePartition parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.InstancePartition parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.InstancePartition parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.InstancePartition parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.InstancePartition parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.InstancePartition parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.InstancePartition parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.InstancePartition parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.InstancePartition parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.InstancePartition parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.InstancePartition prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * An isolated set of Cloud Spanner resources that databases can define
+   * placements on.
+   * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.InstancePartition} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.InstancePartition) + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_InstancePartition_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_InstancePartition_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.InstancePartition.class, + com.google.spanner.admin.instance.v1.InstancePartition.Builder.class); + } + + // Construct using com.google.spanner.admin.instance.v1.InstancePartition.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getCreateTimeFieldBuilder(); + getUpdateTimeFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + config_ = ""; + displayName_ = ""; + state_ = 0; + createTime_ = null; + if (createTimeBuilder_ != null) { + createTimeBuilder_.dispose(); + createTimeBuilder_ = null; + } + updateTime_ = null; + if (updateTimeBuilder_ != null) { + updateTimeBuilder_.dispose(); + updateTimeBuilder_ = null; + } + referencingDatabases_ = com.google.protobuf.LazyStringArrayList.emptyList(); + referencingBackups_ = com.google.protobuf.LazyStringArrayList.emptyList(); + etag_ = ""; + computeCapacityCase_ = 0; + computeCapacity_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_InstancePartition_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartition getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartition build() { + com.google.spanner.admin.instance.v1.InstancePartition result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartition buildPartial() { + com.google.spanner.admin.instance.v1.InstancePartition result = + new com.google.spanner.admin.instance.v1.InstancePartition(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.spanner.admin.instance.v1.InstancePartition result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.config_ = config_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.displayName_ = displayName_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.state_ = state_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000040) != 0)) { + result.createTime_ = createTimeBuilder_ == null ? createTime_ : createTimeBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.updateTime_ = updateTimeBuilder_ == null ? updateTime_ : updateTimeBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + referencingDatabases_.makeImmutable(); + result.referencingDatabases_ = referencingDatabases_; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + referencingBackups_.makeImmutable(); + result.referencingBackups_ = referencingBackups_; + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.etag_ = etag_; + } + result.bitField0_ |= to_bitField0_; + } + + private void buildPartialOneofs(com.google.spanner.admin.instance.v1.InstancePartition result) { + result.computeCapacityCase_ = computeCapacityCase_; + result.computeCapacity_ = this.computeCapacity_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.admin.instance.v1.InstancePartition) { + return mergeFrom((com.google.spanner.admin.instance.v1.InstancePartition) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.spanner.admin.instance.v1.InstancePartition other) { + if (other == com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getConfig().isEmpty()) { + config_ = other.config_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (!other.referencingDatabases_.isEmpty()) { + if (referencingDatabases_.isEmpty()) { + referencingDatabases_ = other.referencingDatabases_; + bitField0_ |= 0x00000100; + } else { + ensureReferencingDatabasesIsMutable(); + referencingDatabases_.addAll(other.referencingDatabases_); + } + onChanged(); + } + if (!other.referencingBackups_.isEmpty()) { + if (referencingBackups_.isEmpty()) { + referencingBackups_ = other.referencingBackups_; + bitField0_ |= 0x00000200; + } else { + ensureReferencingBackupsIsMutable(); + referencingBackups_.addAll(other.referencingBackups_); + } + onChanged(); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + bitField0_ |= 0x00000400; + onChanged(); + } + switch (other.getComputeCapacityCase()) { + case NODE_COUNT: + { + setNodeCount(other.getNodeCount()); + break; + } + case PROCESSING_UNITS: + { + setProcessingUnits(other.getProcessingUnits()); + break; + } + case COMPUTECAPACITY_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + config_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + displayName_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 40: + { + computeCapacity_ = input.readInt32(); + computeCapacityCase_ = 5; + break; + } // case 40 + case 48: + { + computeCapacity_ = input.readInt32(); + computeCapacityCase_ = 6; + break; + } // case 48 + case 56: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000020; + break; + } // case 56 + case 66: + { + input.readMessage(getCreateTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000040; + break; + } // case 66 + case 74: + { + input.readMessage(getUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000080; + break; + } // case 74 + case 82: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureReferencingDatabasesIsMutable(); + referencingDatabases_.add(s); + break; + } // case 82 + case 90: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureReferencingBackupsIsMutable(); + referencingBackups_.add(s); + break; + } // case 90 + case 98: + { + etag_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000400; + break; + } // case 98 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int computeCapacityCase_ = 0; + private java.lang.Object computeCapacity_; + + public ComputeCapacityCase getComputeCapacityCase() { + return ComputeCapacityCase.forNumber(computeCapacityCase_); + } + + public Builder clearComputeCapacity() { + computeCapacityCase_ = 0; + computeCapacity_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. A unique identifier for the instance partition. Values are of the
+     * form
+     * `projects/<project>/instances/<instance>/instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`.
+     * The final segment of the name must be between 2 and 64 characters in
+     * length. An instance partition's name cannot be changed after the instance
+     * partition is created.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. A unique identifier for the instance partition. Values are of the
+     * form
+     * `projects/<project>/instances/<instance>/instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`.
+     * The final segment of the name must be between 2 and 64 characters in
+     * length. An instance partition's name cannot be changed after the instance
+     * partition is created.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. A unique identifier for the instance partition. Values are of the
+     * form
+     * `projects/<project>/instances/<instance>/instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`.
+     * The final segment of the name must be between 2 and 64 characters in
+     * length. An instance partition's name cannot be changed after the instance
+     * partition is created.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. A unique identifier for the instance partition. Values are of the
+     * form
+     * `projects/<project>/instances/<instance>/instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`.
+     * The final segment of the name must be between 2 and 64 characters in
+     * length. An instance partition's name cannot be changed after the instance
+     * partition is created.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. A unique identifier for the instance partition. Values are of the
+     * form
+     * `projects/<project>/instances/<instance>/instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`.
+     * The final segment of the name must be between 2 and 64 characters in
+     * length. An instance partition's name cannot be changed after the instance
+     * partition is created.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object config_ = ""; + /** + * + * + *
+     * Required. The name of the instance partition's configuration. Values are of
+     * the form `projects/<project>/instanceConfigs/<configuration>`. See also
+     * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
+     * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
+     * 
+ * + * + * string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The config. + */ + public java.lang.String getConfig() { + java.lang.Object ref = config_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + config_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the instance partition's configuration. Values are of
+     * the form `projects/<project>/instanceConfigs/<configuration>`. See also
+     * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
+     * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
+     * 
+ * + * + * string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for config. + */ + public com.google.protobuf.ByteString getConfigBytes() { + java.lang.Object ref = config_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + config_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the instance partition's configuration. Values are of
+     * the form `projects/<project>/instanceConfigs/<configuration>`. See also
+     * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
+     * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
+     * 
+ * + * + * string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The config to set. + * @return This builder for chaining. + */ + public Builder setConfig(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + config_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the instance partition's configuration. Values are of
+     * the form `projects/<project>/instanceConfigs/<configuration>`. See also
+     * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
+     * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
+     * 
+ * + * + * string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearConfig() { + config_ = getDefaultInstance().getConfig(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the instance partition's configuration. Values are of
+     * the form `projects/<project>/instanceConfigs/<configuration>`. See also
+     * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
+     * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
+     * 
+ * + * + * string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for config to set. + * @return This builder for chaining. + */ + public Builder setConfigBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + config_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * Required. The descriptive name for this instance partition as it appears in
+     * UIs. Must be unique per project and between 4 and 30 characters in length.
+     * 
+ * + * string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The displayName. + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The descriptive name for this instance partition as it appears in
+     * UIs. Must be unique per project and between 4 and 30 characters in length.
+     * 
+ * + * string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for displayName. + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The descriptive name for this instance partition as it appears in
+     * UIs. Must be unique per project and between 4 and 30 characters in length.
+     * 
+ * + * string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + displayName_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The descriptive name for this instance partition as it appears in
+     * UIs. Must be unique per project and between 4 and 30 characters in length.
+     * 
+ * + * string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + displayName_ = getDefaultInstance().getDisplayName(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The descriptive name for this instance partition as it appears in
+     * UIs. Must be unique per project and between 4 and 30 characters in length.
+     * 
+ * + * string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + displayName_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + /** + * + * + *
+     * The number of nodes allocated to this instance partition.
+     *
+     * Users can set the node_count field to specify the target number of nodes
+     * allocated to the instance partition.
+     *
+     * This may be zero in API responses for instance partitions that are not
+     * yet in state `READY`.
+     * 
+ * + * int32 node_count = 5; + * + * @return Whether the nodeCount field is set. + */ + public boolean hasNodeCount() { + return computeCapacityCase_ == 5; + } + /** + * + * + *
+     * The number of nodes allocated to this instance partition.
+     *
+     * Users can set the node_count field to specify the target number of nodes
+     * allocated to the instance partition.
+     *
+     * This may be zero in API responses for instance partitions that are not
+     * yet in state `READY`.
+     * 
+ * + * int32 node_count = 5; + * + * @return The nodeCount. + */ + public int getNodeCount() { + if (computeCapacityCase_ == 5) { + return (java.lang.Integer) computeCapacity_; + } + return 0; + } + /** + * + * + *
+     * The number of nodes allocated to this instance partition.
+     *
+     * Users can set the node_count field to specify the target number of nodes
+     * allocated to the instance partition.
+     *
+     * This may be zero in API responses for instance partitions that are not
+     * yet in state `READY`.
+     * 
+ * + * int32 node_count = 5; + * + * @param value The nodeCount to set. + * @return This builder for chaining. + */ + public Builder setNodeCount(int value) { + + computeCapacityCase_ = 5; + computeCapacity_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The number of nodes allocated to this instance partition.
+     *
+     * Users can set the node_count field to specify the target number of nodes
+     * allocated to the instance partition.
+     *
+     * This may be zero in API responses for instance partitions that are not
+     * yet in state `READY`.
+     * 
+ * + * int32 node_count = 5; + * + * @return This builder for chaining. + */ + public Builder clearNodeCount() { + if (computeCapacityCase_ == 5) { + computeCapacityCase_ = 0; + computeCapacity_ = null; + onChanged(); + } + return this; + } + + /** + * + * + *
+     * The number of processing units allocated to this instance partition.
+     *
+     * Users can set the processing_units field to specify the target number of
+     * processing units allocated to the instance partition.
+     *
+     * This may be zero in API responses for instance partitions that are not
+     * yet in state `READY`.
+     * 
+ * + * int32 processing_units = 6; + * + * @return Whether the processingUnits field is set. + */ + public boolean hasProcessingUnits() { + return computeCapacityCase_ == 6; + } + /** + * + * + *
+     * The number of processing units allocated to this instance partition.
+     *
+     * Users can set the processing_units field to specify the target number of
+     * processing units allocated to the instance partition.
+     *
+     * This may be zero in API responses for instance partitions that are not
+     * yet in state `READY`.
+     * 
+ * + * int32 processing_units = 6; + * + * @return The processingUnits. + */ + public int getProcessingUnits() { + if (computeCapacityCase_ == 6) { + return (java.lang.Integer) computeCapacity_; + } + return 0; + } + /** + * + * + *
+     * The number of processing units allocated to this instance partition.
+     *
+     * Users can set the processing_units field to specify the target number of
+     * processing units allocated to the instance partition.
+     *
+     * This may be zero in API responses for instance partitions that are not
+     * yet in state `READY`.
+     * 
+ * + * int32 processing_units = 6; + * + * @param value The processingUnits to set. + * @return This builder for chaining. + */ + public Builder setProcessingUnits(int value) { + + computeCapacityCase_ = 6; + computeCapacity_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The number of processing units allocated to this instance partition.
+     *
+     * Users can set the processing_units field to specify the target number of
+     * processing units allocated to the instance partition.
+     *
+     * This may be zero in API responses for instance partitions that are not
+     * yet in state `READY`.
+     * 
+ * + * int32 processing_units = 6; + * + * @return This builder for chaining. + */ + public Builder clearProcessingUnits() { + if (computeCapacityCase_ == 6) { + computeCapacityCase_ = 0; + computeCapacity_ = null; + onChanged(); + } + return this; + } + + private int state_ = 0; + /** + * + * + *
+     * Output only. The current instance partition state.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+     * Output only. The current instance partition state.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The current instance partition state.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartition.State getState() { + com.google.spanner.admin.instance.v1.InstancePartition.State result = + com.google.spanner.admin.instance.v1.InstancePartition.State.forNumber(state_); + return result == null + ? com.google.spanner.admin.instance.v1.InstancePartition.State.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Output only. The current instance partition state.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.spanner.admin.instance.v1.InstancePartition.State value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000020; + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The current instance partition state.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000020); + state_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. The time at which the instance partition was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return ((bitField0_ & 0x00000040) != 0); + } + /** + * + * + *
+     * Output only. The time at which the instance partition was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time at which the instance partition was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + } else { + createTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The time at which the instance partition was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The time at which the instance partition was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (((bitField0_ & 0x00000040) != 0) + && createTime_ != null + && createTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getCreateTimeBuilder().mergeFrom(value); + } else { + createTime_ = value; + } + } else { + createTimeBuilder_.mergeFrom(value); + } + if (createTime_ != null) { + bitField0_ |= 0x00000040; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Output only. The time at which the instance partition was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + bitField0_ = (bitField0_ & ~0x00000040); + createTime_ = null; + if (createTimeBuilder_ != null) { + createTimeBuilder_.dispose(); + createTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The time at which the instance partition was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + bitField0_ |= 0x00000040; + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time at which the instance partition was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. The time at which the instance partition was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Output only. The time at which the instance partition was most recently
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return ((bitField0_ & 0x00000080) != 0); + } + /** + * + * + *
+     * Output only. The time at which the instance partition was most recently
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time at which the instance partition was most recently
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + } else { + updateTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The time at which the instance partition was most recently
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The time at which the instance partition was most recently
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (((bitField0_ & 0x00000080) != 0) + && updateTime_ != null + && updateTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getUpdateTimeBuilder().mergeFrom(value); + } else { + updateTime_ = value; + } + } else { + updateTimeBuilder_.mergeFrom(value); + } + if (updateTime_ != null) { + bitField0_ |= 0x00000080; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Output only. The time at which the instance partition was most recently
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearUpdateTime() { + bitField0_ = (bitField0_ & ~0x00000080); + updateTime_ = null; + if (updateTimeBuilder_ != null) { + updateTimeBuilder_.dispose(); + updateTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The time at which the instance partition was most recently
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + bitField0_ |= 0x00000080; + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time at which the instance partition was most recently
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Output only. The time at which the instance partition was most recently
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private com.google.protobuf.LazyStringArrayList referencingDatabases_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureReferencingDatabasesIsMutable() { + if (!referencingDatabases_.isModifiable()) { + referencingDatabases_ = new com.google.protobuf.LazyStringArrayList(referencingDatabases_); + } + bitField0_ |= 0x00000100; + } + /** + * + * + *
+     * Output only. The names of the databases that reference this
+     * instance partition. Referencing databases should share the parent instance.
+     * The existence of any referencing database prevents the instance partition
+     * from being deleted.
+     * 
+ * + * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the referencingDatabases. + */ + public com.google.protobuf.ProtocolStringList getReferencingDatabasesList() { + referencingDatabases_.makeImmutable(); + return referencingDatabases_; + } + /** + * + * + *
+     * Output only. The names of the databases that reference this
+     * instance partition. Referencing databases should share the parent instance.
+     * The existence of any referencing database prevents the instance partition
+     * from being deleted.
+     * 
+ * + * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The count of referencingDatabases. + */ + public int getReferencingDatabasesCount() { + return referencingDatabases_.size(); + } + /** + * + * + *
+     * Output only. The names of the databases that reference this
+     * instance partition. Referencing databases should share the parent instance.
+     * The existence of any referencing database prevents the instance partition
+     * from being deleted.
+     * 
+ * + * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the element to return. + * @return The referencingDatabases at the given index. + */ + public java.lang.String getReferencingDatabases(int index) { + return referencingDatabases_.get(index); + } + /** + * + * + *
+     * Output only. The names of the databases that reference this
+     * instance partition. Referencing databases should share the parent instance.
+     * The existence of any referencing database prevents the instance partition
+     * from being deleted.
+     * 
+ * + * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the value to return. + * @return The bytes of the referencingDatabases at the given index. + */ + public com.google.protobuf.ByteString getReferencingDatabasesBytes(int index) { + return referencingDatabases_.getByteString(index); + } + /** + * + * + *
+     * Output only. The names of the databases that reference this
+     * instance partition. Referencing databases should share the parent instance.
+     * The existence of any referencing database prevents the instance partition
+     * from being deleted.
+     * 
+ * + * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index to set the value at. + * @param value The referencingDatabases to set. + * @return This builder for chaining. + */ + public Builder setReferencingDatabases(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureReferencingDatabasesIsMutable(); + referencingDatabases_.set(index, value); + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The names of the databases that reference this
+     * instance partition. Referencing databases should share the parent instance.
+     * The existence of any referencing database prevents the instance partition
+     * from being deleted.
+     * 
+ * + * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The referencingDatabases to add. + * @return This builder for chaining. + */ + public Builder addReferencingDatabases(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureReferencingDatabasesIsMutable(); + referencingDatabases_.add(value); + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The names of the databases that reference this
+     * instance partition. Referencing databases should share the parent instance.
+     * The existence of any referencing database prevents the instance partition
+     * from being deleted.
+     * 
+ * + * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param values The referencingDatabases to add. + * @return This builder for chaining. + */ + public Builder addAllReferencingDatabases(java.lang.Iterable values) { + ensureReferencingDatabasesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, referencingDatabases_); + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The names of the databases that reference this
+     * instance partition. Referencing databases should share the parent instance.
+     * The existence of any referencing database prevents the instance partition
+     * from being deleted.
+     * 
+ * + * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearReferencingDatabases() { + referencingDatabases_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000100); + ; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The names of the databases that reference this
+     * instance partition. Referencing databases should share the parent instance.
+     * The existence of any referencing database prevents the instance partition
+     * from being deleted.
+     * 
+ * + * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The bytes of the referencingDatabases to add. + * @return This builder for chaining. + */ + public Builder addReferencingDatabasesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureReferencingDatabasesIsMutable(); + referencingDatabases_.add(value); + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList referencingBackups_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureReferencingBackupsIsMutable() { + if (!referencingBackups_.isModifiable()) { + referencingBackups_ = new com.google.protobuf.LazyStringArrayList(referencingBackups_); + } + bitField0_ |= 0x00000200; + } + /** + * + * + *
+     * Output only. The names of the backups that reference this instance
+     * partition. Referencing backups should share the parent instance. The
+     * existence of any referencing backup prevents the instance partition from
+     * being deleted.
+     * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the referencingBackups. + */ + public com.google.protobuf.ProtocolStringList getReferencingBackupsList() { + referencingBackups_.makeImmutable(); + return referencingBackups_; + } + /** + * + * + *
+     * Output only. The names of the backups that reference this instance
+     * partition. Referencing backups should share the parent instance. The
+     * existence of any referencing backup prevents the instance partition from
+     * being deleted.
+     * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The count of referencingBackups. + */ + public int getReferencingBackupsCount() { + return referencingBackups_.size(); + } + /** + * + * + *
+     * Output only. The names of the backups that reference this instance
+     * partition. Referencing backups should share the parent instance. The
+     * existence of any referencing backup prevents the instance partition from
+     * being deleted.
+     * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the element to return. + * @return The referencingBackups at the given index. + */ + public java.lang.String getReferencingBackups(int index) { + return referencingBackups_.get(index); + } + /** + * + * + *
+     * Output only. The names of the backups that reference this instance
+     * partition. Referencing backups should share the parent instance. The
+     * existence of any referencing backup prevents the instance partition from
+     * being deleted.
+     * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the value to return. + * @return The bytes of the referencingBackups at the given index. + */ + public com.google.protobuf.ByteString getReferencingBackupsBytes(int index) { + return referencingBackups_.getByteString(index); + } + /** + * + * + *
+     * Output only. The names of the backups that reference this instance
+     * partition. Referencing backups should share the parent instance. The
+     * existence of any referencing backup prevents the instance partition from
+     * being deleted.
+     * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index to set the value at. + * @param value The referencingBackups to set. + * @return This builder for chaining. + */ + public Builder setReferencingBackups(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureReferencingBackupsIsMutable(); + referencingBackups_.set(index, value); + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The names of the backups that reference this instance
+     * partition. Referencing backups should share the parent instance. The
+     * existence of any referencing backup prevents the instance partition from
+     * being deleted.
+     * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The referencingBackups to add. + * @return This builder for chaining. + */ + public Builder addReferencingBackups(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureReferencingBackupsIsMutable(); + referencingBackups_.add(value); + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The names of the backups that reference this instance
+     * partition. Referencing backups should share the parent instance. The
+     * existence of any referencing backup prevents the instance partition from
+     * being deleted.
+     * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param values The referencingBackups to add. + * @return This builder for chaining. + */ + public Builder addAllReferencingBackups(java.lang.Iterable values) { + ensureReferencingBackupsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, referencingBackups_); + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The names of the backups that reference this instance
+     * partition. Referencing backups should share the parent instance. The
+     * existence of any referencing backup prevents the instance partition from
+     * being deleted.
+     * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearReferencingBackups() { + referencingBackups_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000200); + ; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The names of the backups that reference this instance
+     * partition. Referencing backups should share the parent instance. The
+     * existence of any referencing backup prevents the instance partition from
+     * being deleted.
+     * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The bytes of the referencingBackups to add. + * @return This builder for chaining. + */ + public Builder addReferencingBackupsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureReferencingBackupsIsMutable(); + referencingBackups_.add(value); + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Used for optimistic concurrency control as a way
+     * to help prevent simultaneous updates of a instance partition from
+     * overwriting each other. It is strongly suggested that systems make use of
+     * the etag in the read-modify-write cycle to perform instance partition
+     * updates in order to avoid race conditions: An etag is returned in the
+     * response which contains instance partitions, and systems are expected to
+     * put that etag in the request to update instance partitions to ensure that
+     * their change will be applied to the same version of the instance partition.
+     * If no etag is provided in the call to update instance partition, then the
+     * existing instance partition is overwritten blindly.
+     * 
+ * + * string etag = 12; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Used for optimistic concurrency control as a way
+     * to help prevent simultaneous updates of a instance partition from
+     * overwriting each other. It is strongly suggested that systems make use of
+     * the etag in the read-modify-write cycle to perform instance partition
+     * updates in order to avoid race conditions: An etag is returned in the
+     * response which contains instance partitions, and systems are expected to
+     * put that etag in the request to update instance partitions to ensure that
+     * their change will be applied to the same version of the instance partition.
+     * If no etag is provided in the call to update instance partition, then the
+     * existing instance partition is overwritten blindly.
+     * 
+ * + * string etag = 12; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Used for optimistic concurrency control as a way
+     * to help prevent simultaneous updates of a instance partition from
+     * overwriting each other. It is strongly suggested that systems make use of
+     * the etag in the read-modify-write cycle to perform instance partition
+     * updates in order to avoid race conditions: An etag is returned in the
+     * response which contains instance partitions, and systems are expected to
+     * put that etag in the request to update instance partitions to ensure that
+     * their change will be applied to the same version of the instance partition.
+     * If no etag is provided in the call to update instance partition, then the
+     * existing instance partition is overwritten blindly.
+     * 
+ * + * string etag = 12; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + etag_ = value; + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + /** + * + * + *
+     * Used for optimistic concurrency control as a way
+     * to help prevent simultaneous updates of a instance partition from
+     * overwriting each other. It is strongly suggested that systems make use of
+     * the etag in the read-modify-write cycle to perform instance partition
+     * updates in order to avoid race conditions: An etag is returned in the
+     * response which contains instance partitions, and systems are expected to
+     * put that etag in the request to update instance partitions to ensure that
+     * their change will be applied to the same version of the instance partition.
+     * If no etag is provided in the call to update instance partition, then the
+     * existing instance partition is overwritten blindly.
+     * 
+ * + * string etag = 12; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + etag_ = getDefaultInstance().getEtag(); + bitField0_ = (bitField0_ & ~0x00000400); + onChanged(); + return this; + } + /** + * + * + *
+     * Used for optimistic concurrency control as a way
+     * to help prevent simultaneous updates of a instance partition from
+     * overwriting each other. It is strongly suggested that systems make use of
+     * the etag in the read-modify-write cycle to perform instance partition
+     * updates in order to avoid race conditions: An etag is returned in the
+     * response which contains instance partitions, and systems are expected to
+     * put that etag in the request to update instance partitions to ensure that
+     * their change will be applied to the same version of the instance partition.
+     * If no etag is provided in the call to update instance partition, then the
+     * existing instance partition is overwritten blindly.
+     * 
+ * + * string etag = 12; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + etag_ = value; + bitField0_ |= 0x00000400; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.InstancePartition) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.InstancePartition) + private static final com.google.spanner.admin.instance.v1.InstancePartition DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.admin.instance.v1.InstancePartition(); + } + + public static com.google.spanner.admin.instance.v1.InstancePartition getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public InstancePartition parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartition getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstancePartitionName.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstancePartitionName.java new file mode 100644 index 00000000000..a0062eb8f67 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstancePartitionName.java @@ -0,0 +1,231 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.spanner.admin.instance.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class InstancePartitionName implements ResourceName { + private static final PathTemplate PROJECT_INSTANCE_INSTANCE_PARTITION = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/instances/{instance}/instancePartitions/{instance_partition}"); + private volatile Map fieldValuesMap; + private final String project; + private final String instance; + private final String instancePartition; + + @Deprecated + protected InstancePartitionName() { + project = null; + instance = null; + instancePartition = null; + } + + private InstancePartitionName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + instance = Preconditions.checkNotNull(builder.getInstance()); + instancePartition = Preconditions.checkNotNull(builder.getInstancePartition()); + } + + public String getProject() { + return project; + } + + public String getInstance() { + return instance; + } + + public String getInstancePartition() { + return instancePartition; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static InstancePartitionName of( + String project, String instance, String instancePartition) { + return newBuilder() + .setProject(project) + .setInstance(instance) + .setInstancePartition(instancePartition) + .build(); + } + + public static String format(String project, String instance, String instancePartition) { + return newBuilder() + .setProject(project) + .setInstance(instance) + .setInstancePartition(instancePartition) + .build() + .toString(); + } + + public static InstancePartitionName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_INSTANCE_INSTANCE_PARTITION.validatedMatch( + formattedString, "InstancePartitionName.parse: formattedString not in valid format"); + return of( + matchMap.get("project"), matchMap.get("instance"), matchMap.get("instance_partition")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (InstancePartitionName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_INSTANCE_INSTANCE_PARTITION.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (instance != null) { + fieldMapBuilder.put("instance", instance); + } + if (instancePartition != null) { + fieldMapBuilder.put("instance_partition", instancePartition); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_INSTANCE_INSTANCE_PARTITION.instantiate( + "project", project, "instance", instance, "instance_partition", instancePartition); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null && getClass() == o.getClass()) { + InstancePartitionName that = ((InstancePartitionName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.instance, that.instance) + && Objects.equals(this.instancePartition, that.instancePartition); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(instance); + h *= 1000003; + h ^= Objects.hashCode(instancePartition); + return h; + } + + /** + * Builder for projects/{project}/instances/{instance}/instancePartitions/{instance_partition}. + */ + public static class Builder { + private String project; + private String instance; + private String instancePartition; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getInstance() { + return instance; + } + + public String getInstancePartition() { + return instancePartition; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setInstance(String instance) { + this.instance = instance; + return this; + } + + public Builder setInstancePartition(String instancePartition) { + this.instancePartition = instancePartition; + return this; + } + + private Builder(InstancePartitionName instancePartitionName) { + this.project = instancePartitionName.project; + this.instance = instancePartitionName.instance; + this.instancePartition = instancePartitionName.instancePartition; + } + + public InstancePartitionName build() { + return new InstancePartitionName(this); + } + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstancePartitionOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstancePartitionOrBuilder.java new file mode 100644 index 00000000000..d8c91e9ab7f --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstancePartitionOrBuilder.java @@ -0,0 +1,485 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +public interface InstancePartitionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.InstancePartition) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. A unique identifier for the instance partition. Values are of the
+   * form
+   * `projects/<project>/instances/<instance>/instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`.
+   * The final segment of the name must be between 2 and 64 characters in
+   * length. An instance partition's name cannot be changed after the instance
+   * partition is created.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. A unique identifier for the instance partition. Values are of the
+   * form
+   * `projects/<project>/instances/<instance>/instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`.
+   * The final segment of the name must be between 2 and 64 characters in
+   * length. An instance partition's name cannot be changed after the instance
+   * partition is created.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Required. The name of the instance partition's configuration. Values are of
+   * the form `projects/<project>/instanceConfigs/<configuration>`. See also
+   * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
+   * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
+   * 
+ * + * + * string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The config. + */ + java.lang.String getConfig(); + /** + * + * + *
+   * Required. The name of the instance partition's configuration. Values are of
+   * the form `projects/<project>/instanceConfigs/<configuration>`. See also
+   * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
+   * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
+   * 
+ * + * + * string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for config. + */ + com.google.protobuf.ByteString getConfigBytes(); + + /** + * + * + *
+   * Required. The descriptive name for this instance partition as it appears in
+   * UIs. Must be unique per project and between 4 and 30 characters in length.
+   * 
+ * + * string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * Required. The descriptive name for this instance partition as it appears in
+   * UIs. Must be unique per project and between 4 and 30 characters in length.
+   * 
+ * + * string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * The number of nodes allocated to this instance partition.
+   *
+   * Users can set the node_count field to specify the target number of nodes
+   * allocated to the instance partition.
+   *
+   * This may be zero in API responses for instance partitions that are not
+   * yet in state `READY`.
+   * 
+ * + * int32 node_count = 5; + * + * @return Whether the nodeCount field is set. + */ + boolean hasNodeCount(); + /** + * + * + *
+   * The number of nodes allocated to this instance partition.
+   *
+   * Users can set the node_count field to specify the target number of nodes
+   * allocated to the instance partition.
+   *
+   * This may be zero in API responses for instance partitions that are not
+   * yet in state `READY`.
+   * 
+ * + * int32 node_count = 5; + * + * @return The nodeCount. + */ + int getNodeCount(); + + /** + * + * + *
+   * The number of processing units allocated to this instance partition.
+   *
+   * Users can set the processing_units field to specify the target number of
+   * processing units allocated to the instance partition.
+   *
+   * This may be zero in API responses for instance partitions that are not
+   * yet in state `READY`.
+   * 
+ * + * int32 processing_units = 6; + * + * @return Whether the processingUnits field is set. + */ + boolean hasProcessingUnits(); + /** + * + * + *
+   * The number of processing units allocated to this instance partition.
+   *
+   * Users can set the processing_units field to specify the target number of
+   * processing units allocated to the instance partition.
+   *
+   * This may be zero in API responses for instance partitions that are not
+   * yet in state `READY`.
+   * 
+ * + * int32 processing_units = 6; + * + * @return The processingUnits. + */ + int getProcessingUnits(); + + /** + * + * + *
+   * Output only. The current instance partition state.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + /** + * + * + *
+   * Output only. The current instance partition state.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.spanner.admin.instance.v1.InstancePartition.State getState(); + + /** + * + * + *
+   * Output only. The time at which the instance partition was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. The time at which the instance partition was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. The time at which the instance partition was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The time at which the instance partition was most recently
+   * updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Output only. The time at which the instance partition was most recently
+   * updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Output only. The time at which the instance partition was most recently
+   * updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The names of the databases that reference this
+   * instance partition. Referencing databases should share the parent instance.
+   * The existence of any referencing database prevents the instance partition
+   * from being deleted.
+   * 
+ * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the referencingDatabases. + */ + java.util.List getReferencingDatabasesList(); + /** + * + * + *
+   * Output only. The names of the databases that reference this
+   * instance partition. Referencing databases should share the parent instance.
+   * The existence of any referencing database prevents the instance partition
+   * from being deleted.
+   * 
+ * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The count of referencingDatabases. + */ + int getReferencingDatabasesCount(); + /** + * + * + *
+   * Output only. The names of the databases that reference this
+   * instance partition. Referencing databases should share the parent instance.
+   * The existence of any referencing database prevents the instance partition
+   * from being deleted.
+   * 
+ * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the element to return. + * @return The referencingDatabases at the given index. + */ + java.lang.String getReferencingDatabases(int index); + /** + * + * + *
+   * Output only. The names of the databases that reference this
+   * instance partition. Referencing databases should share the parent instance.
+   * The existence of any referencing database prevents the instance partition
+   * from being deleted.
+   * 
+ * + * repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the value to return. + * @return The bytes of the referencingDatabases at the given index. + */ + com.google.protobuf.ByteString getReferencingDatabasesBytes(int index); + + /** + * + * + *
+   * Output only. The names of the backups that reference this instance
+   * partition. Referencing backups should share the parent instance. The
+   * existence of any referencing backup prevents the instance partition from
+   * being deleted.
+   * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return A list containing the referencingBackups. + */ + java.util.List getReferencingBackupsList(); + /** + * + * + *
+   * Output only. The names of the backups that reference this instance
+   * partition. Referencing backups should share the parent instance. The
+   * existence of any referencing backup prevents the instance partition from
+   * being deleted.
+   * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The count of referencingBackups. + */ + int getReferencingBackupsCount(); + /** + * + * + *
+   * Output only. The names of the backups that reference this instance
+   * partition. Referencing backups should share the parent instance. The
+   * existence of any referencing backup prevents the instance partition from
+   * being deleted.
+   * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the element to return. + * @return The referencingBackups at the given index. + */ + java.lang.String getReferencingBackups(int index); + /** + * + * + *
+   * Output only. The names of the backups that reference this instance
+   * partition. Referencing backups should share the parent instance. The
+   * existence of any referencing backup prevents the instance partition from
+   * being deleted.
+   * 
+ * + * repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param index The index of the value to return. + * @return The bytes of the referencingBackups at the given index. + */ + com.google.protobuf.ByteString getReferencingBackupsBytes(int index); + + /** + * + * + *
+   * Used for optimistic concurrency control as a way
+   * to help prevent simultaneous updates of a instance partition from
+   * overwriting each other. It is strongly suggested that systems make use of
+   * the etag in the read-modify-write cycle to perform instance partition
+   * updates in order to avoid race conditions: An etag is returned in the
+   * response which contains instance partitions, and systems are expected to
+   * put that etag in the request to update instance partitions to ensure that
+   * their change will be applied to the same version of the instance partition.
+   * If no etag is provided in the call to update instance partition, then the
+   * existing instance partition is overwritten blindly.
+   * 
+ * + * string etag = 12; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Used for optimistic concurrency control as a way
+   * to help prevent simultaneous updates of a instance partition from
+   * overwriting each other. It is strongly suggested that systems make use of
+   * the etag in the read-modify-write cycle to perform instance partition
+   * updates in order to avoid race conditions: An etag is returned in the
+   * response which contains instance partitions, and systems are expected to
+   * put that etag in the request to update instance partitions to ensure that
+   * their change will be applied to the same version of the instance partition.
+   * If no etag is provided in the call to update instance partition, then the
+   * existing instance partition is overwritten blindly.
+   * 
+ * + * string etag = 12; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); + + com.google.spanner.admin.instance.v1.InstancePartition.ComputeCapacityCase + getComputeCapacityCase(); +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsRequest.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsRequest.java new file mode 100644 index 00000000000..4d7bc75f014 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsRequest.java @@ -0,0 +1,1816 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +/** + * + * + *
+ * The request for
+ * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations].
+ * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest} + */ +public final class ListInstancePartitionOperationsRequest + extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest) + ListInstancePartitionOperationsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListInstancePartitionOperationsRequest.newBuilder() to construct. + private ListInstancePartitionOperationsRequest( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListInstancePartitionOperationsRequest() { + parent_ = ""; + filter_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListInstancePartitionOperationsRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.class, + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.Builder + .class); + } + + private int bitField0_; + public static final int PARENT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + * + * + *
+   * Required. The parent instance of the instance partition operations.
+   * Values are of the form `projects/<project>/instances/<instance>`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + 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(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The parent instance of the instance partition operations.
+   * Values are of the form `projects/<project>/instances/<instance>`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILTER_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object filter_ = ""; + /** + * + * + *
+   * Optional. An expression that filters the list of returned operations.
+   *
+   * A filter expression consists of a field name, a
+   * comparison operator, and a value for filtering.
+   * The value must be a string, a number, or a boolean. The comparison operator
+   * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
+   * Colon `:` is the contains operator. Filter rules are not case sensitive.
+   *
+   * The following fields in the [Operation][google.longrunning.Operation]
+   * are eligible for filtering:
+   *
+   *   * `name` - The name of the long-running operation
+   *   * `done` - False if the operation is in progress, else true.
+   *   * `metadata.@type` - the type of metadata. For example, the type string
+   *      for
+   *      [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
+   *      is
+   *      `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
+   *   * `metadata.<field_name>` - any field in metadata.value.
+   *      `metadata.@type` must be specified first, if filtering on metadata
+   *      fields.
+   *   * `error` - Error associated with the long-running operation.
+   *   * `response.@type` - the type of response.
+   *   * `response.<field_name>` - any field in response.value.
+   *
+   * You can combine multiple expressions by enclosing each expression in
+   * parentheses. By default, expressions are combined with AND logic. However,
+   * you can specify AND, OR, and NOT logic explicitly.
+   *
+   * Here are a few examples:
+   *
+   *   * `done:true` - The operation is complete.
+   *   * `(metadata.@type=` \
+   *     `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
+   *     AND` \
+   *     `(metadata.instance_partition.name:custom-instance-partition) AND` \
+   *     `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
+   *     `(error:*)` - Return operations where:
+   *     * The operation's metadata type is
+   *     [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
+   *     * The instance partition name contains "custom-instance-partition".
+   *     * The operation started before 2021-03-28T14:50:00Z.
+   *     * The operation resulted in an error.
+   * 
+ * + * string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filter. + */ + @java.lang.Override + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + 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(); + filter_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. An expression that filters the list of returned operations.
+   *
+   * A filter expression consists of a field name, a
+   * comparison operator, and a value for filtering.
+   * The value must be a string, a number, or a boolean. The comparison operator
+   * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
+   * Colon `:` is the contains operator. Filter rules are not case sensitive.
+   *
+   * The following fields in the [Operation][google.longrunning.Operation]
+   * are eligible for filtering:
+   *
+   *   * `name` - The name of the long-running operation
+   *   * `done` - False if the operation is in progress, else true.
+   *   * `metadata.@type` - the type of metadata. For example, the type string
+   *      for
+   *      [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
+   *      is
+   *      `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
+   *   * `metadata.<field_name>` - any field in metadata.value.
+   *      `metadata.@type` must be specified first, if filtering on metadata
+   *      fields.
+   *   * `error` - Error associated with the long-running operation.
+   *   * `response.@type` - the type of response.
+   *   * `response.<field_name>` - any field in response.value.
+   *
+   * You can combine multiple expressions by enclosing each expression in
+   * parentheses. By default, expressions are combined with AND logic. However,
+   * you can specify AND, OR, and NOT logic explicitly.
+   *
+   * Here are a few examples:
+   *
+   *   * `done:true` - The operation is complete.
+   *   * `(metadata.@type=` \
+   *     `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
+   *     AND` \
+   *     `(metadata.instance_partition.name:custom-instance-partition) AND` \
+   *     `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
+   *     `(error:*)` - Return operations where:
+   *     * The operation's metadata type is
+   *     [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
+   *     * The instance partition name contains "custom-instance-partition".
+   *     * The operation started before 2021-03-28T14:50:00Z.
+   *     * The operation resulted in an error.
+   * 
+ * + * string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filter. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 3; + private int pageSize_ = 0; + /** + * + * + *
+   * Optional. Number of operations to be returned in the response. If 0 or
+   * less, defaults to the server's maximum allowed page size.
+   * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 4; + + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + /** + * + * + *
+   * Optional. If non-empty, `page_token` should contain a
+   * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]
+   * from a previous
+   * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]
+   * to the same `parent` and with the same `filter`.
+   * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + 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(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. If non-empty, `page_token` should contain a
+   * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]
+   * from a previous
+   * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]
+   * to the same `parent` and with the same `filter`.
+   * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INSTANCE_PARTITION_DEADLINE_FIELD_NUMBER = 5; + private com.google.protobuf.Timestamp instancePartitionDeadline_; + /** + * + * + *
+   * Optional. Deadline used while retrieving metadata for instance partition
+   * operations. Instance partitions whose operation metadata cannot be
+   * retrieved within this deadline will be added to
+   * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+   * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+   * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the instancePartitionDeadline field is set. + */ + @java.lang.Override + public boolean hasInstancePartitionDeadline() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Optional. Deadline used while retrieving metadata for instance partition
+   * operations. Instance partitions whose operation metadata cannot be
+   * retrieved within this deadline will be added to
+   * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+   * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+   * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The instancePartitionDeadline. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getInstancePartitionDeadline() { + return instancePartitionDeadline_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : instancePartitionDeadline_; + } + /** + * + * + *
+   * Optional. Deadline used while retrieving metadata for instance partition
+   * operations. Instance partitions whose operation metadata cannot be
+   * retrieved within this deadline will be added to
+   * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+   * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+   * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getInstancePartitionDeadlineOrBuilder() { + return instancePartitionDeadline_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : instancePartitionDeadline_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, filter_); + } + if (pageSize_ != 0) { + output.writeInt32(3, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, pageToken_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(5, getInstancePartitionDeadline()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, filter_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, pageToken_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, getInstancePartitionDeadline()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest other = + (com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (!getFilter().equals(other.getFilter())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (hasInstancePartitionDeadline() != other.hasInstancePartitionDeadline()) return false; + if (hasInstancePartitionDeadline()) { + if (!getInstancePartitionDeadline().equals(other.getInstancePartitionDeadline())) + return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + if (hasInstancePartitionDeadline()) { + hash = (37 * hash) + INSTANCE_PARTITION_DEADLINE_FIELD_NUMBER; + hash = (53 * hash) + getInstancePartitionDeadline().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request for
+   * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations].
+   * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest) + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.class, + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.Builder + .class); + } + + // Construct using + // com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getInstancePartitionDeadlineFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + filter_ = ""; + pageSize_ = 0; + pageToken_ = ""; + instancePartitionDeadline_ = null; + if (instancePartitionDeadlineBuilder_ != null) { + instancePartitionDeadlineBuilder_.dispose(); + instancePartitionDeadlineBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsRequest_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest build() { + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + buildPartial() { + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest result = + new com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.filter_ = filter_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.pageToken_ = pageToken_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000010) != 0)) { + result.instancePartitionDeadline_ = + instancePartitionDeadlineBuilder_ == null + ? instancePartitionDeadline_ + : instancePartitionDeadlineBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest) { + return mergeFrom( + (com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest other) { + if (other + == com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + .getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + bitField0_ |= 0x00000008; + onChanged(); + } + if (other.hasInstancePartitionDeadline()) { + mergeInstancePartitionDeadline(other.getInstancePartitionDeadline()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + filter_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 24: + { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 34: + { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 34 + case 42: + { + input.readMessage( + getInstancePartitionDeadlineFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000010; + break; + } // case 42 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The parent instance of the instance partition operations.
+     * Values are of the form `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The parent instance of the instance partition operations.
+     * Values are of the form `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The parent instance of the instance partition operations.
+     * Values are of the form `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent instance of the instance partition operations.
+     * Values are of the form `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent instance of the instance partition operations.
+     * Values are of the form `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object filter_ = ""; + /** + * + * + *
+     * Optional. An expression that filters the list of returned operations.
+     *
+     * A filter expression consists of a field name, a
+     * comparison operator, and a value for filtering.
+     * The value must be a string, a number, or a boolean. The comparison operator
+     * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
+     * Colon `:` is the contains operator. Filter rules are not case sensitive.
+     *
+     * The following fields in the [Operation][google.longrunning.Operation]
+     * are eligible for filtering:
+     *
+     *   * `name` - The name of the long-running operation
+     *   * `done` - False if the operation is in progress, else true.
+     *   * `metadata.@type` - the type of metadata. For example, the type string
+     *      for
+     *      [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
+     *      is
+     *      `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
+     *   * `metadata.<field_name>` - any field in metadata.value.
+     *      `metadata.@type` must be specified first, if filtering on metadata
+     *      fields.
+     *   * `error` - Error associated with the long-running operation.
+     *   * `response.@type` - the type of response.
+     *   * `response.<field_name>` - any field in response.value.
+     *
+     * You can combine multiple expressions by enclosing each expression in
+     * parentheses. By default, expressions are combined with AND logic. However,
+     * you can specify AND, OR, and NOT logic explicitly.
+     *
+     * Here are a few examples:
+     *
+     *   * `done:true` - The operation is complete.
+     *   * `(metadata.@type=` \
+     *     `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
+     *     AND` \
+     *     `(metadata.instance_partition.name:custom-instance-partition) AND` \
+     *     `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
+     *     `(error:*)` - Return operations where:
+     *     * The operation's metadata type is
+     *     [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
+     *     * The instance partition name contains "custom-instance-partition".
+     *     * The operation started before 2021-03-28T14:50:00Z.
+     *     * The operation resulted in an error.
+     * 
+ * + * string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filter. + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. An expression that filters the list of returned operations.
+     *
+     * A filter expression consists of a field name, a
+     * comparison operator, and a value for filtering.
+     * The value must be a string, a number, or a boolean. The comparison operator
+     * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
+     * Colon `:` is the contains operator. Filter rules are not case sensitive.
+     *
+     * The following fields in the [Operation][google.longrunning.Operation]
+     * are eligible for filtering:
+     *
+     *   * `name` - The name of the long-running operation
+     *   * `done` - False if the operation is in progress, else true.
+     *   * `metadata.@type` - the type of metadata. For example, the type string
+     *      for
+     *      [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
+     *      is
+     *      `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
+     *   * `metadata.<field_name>` - any field in metadata.value.
+     *      `metadata.@type` must be specified first, if filtering on metadata
+     *      fields.
+     *   * `error` - Error associated with the long-running operation.
+     *   * `response.@type` - the type of response.
+     *   * `response.<field_name>` - any field in response.value.
+     *
+     * You can combine multiple expressions by enclosing each expression in
+     * parentheses. By default, expressions are combined with AND logic. However,
+     * you can specify AND, OR, and NOT logic explicitly.
+     *
+     * Here are a few examples:
+     *
+     *   * `done:true` - The operation is complete.
+     *   * `(metadata.@type=` \
+     *     `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
+     *     AND` \
+     *     `(metadata.instance_partition.name:custom-instance-partition) AND` \
+     *     `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
+     *     `(error:*)` - Return operations where:
+     *     * The operation's metadata type is
+     *     [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
+     *     * The instance partition name contains "custom-instance-partition".
+     *     * The operation started before 2021-03-28T14:50:00Z.
+     *     * The operation resulted in an error.
+     * 
+ * + * string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filter. + */ + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. An expression that filters the list of returned operations.
+     *
+     * A filter expression consists of a field name, a
+     * comparison operator, and a value for filtering.
+     * The value must be a string, a number, or a boolean. The comparison operator
+     * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
+     * Colon `:` is the contains operator. Filter rules are not case sensitive.
+     *
+     * The following fields in the [Operation][google.longrunning.Operation]
+     * are eligible for filtering:
+     *
+     *   * `name` - The name of the long-running operation
+     *   * `done` - False if the operation is in progress, else true.
+     *   * `metadata.@type` - the type of metadata. For example, the type string
+     *      for
+     *      [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
+     *      is
+     *      `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
+     *   * `metadata.<field_name>` - any field in metadata.value.
+     *      `metadata.@type` must be specified first, if filtering on metadata
+     *      fields.
+     *   * `error` - Error associated with the long-running operation.
+     *   * `response.@type` - the type of response.
+     *   * `response.<field_name>` - any field in response.value.
+     *
+     * You can combine multiple expressions by enclosing each expression in
+     * parentheses. By default, expressions are combined with AND logic. However,
+     * you can specify AND, OR, and NOT logic explicitly.
+     *
+     * Here are a few examples:
+     *
+     *   * `done:true` - The operation is complete.
+     *   * `(metadata.@type=` \
+     *     `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
+     *     AND` \
+     *     `(metadata.instance_partition.name:custom-instance-partition) AND` \
+     *     `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
+     *     `(error:*)` - Return operations where:
+     *     * The operation's metadata type is
+     *     [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
+     *     * The instance partition name contains "custom-instance-partition".
+     *     * The operation started before 2021-03-28T14:50:00Z.
+     *     * The operation resulted in an error.
+     * 
+ * + * string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The filter to set. + * @return This builder for chaining. + */ + public Builder setFilter(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + filter_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. An expression that filters the list of returned operations.
+     *
+     * A filter expression consists of a field name, a
+     * comparison operator, and a value for filtering.
+     * The value must be a string, a number, or a boolean. The comparison operator
+     * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
+     * Colon `:` is the contains operator. Filter rules are not case sensitive.
+     *
+     * The following fields in the [Operation][google.longrunning.Operation]
+     * are eligible for filtering:
+     *
+     *   * `name` - The name of the long-running operation
+     *   * `done` - False if the operation is in progress, else true.
+     *   * `metadata.@type` - the type of metadata. For example, the type string
+     *      for
+     *      [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
+     *      is
+     *      `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
+     *   * `metadata.<field_name>` - any field in metadata.value.
+     *      `metadata.@type` must be specified first, if filtering on metadata
+     *      fields.
+     *   * `error` - Error associated with the long-running operation.
+     *   * `response.@type` - the type of response.
+     *   * `response.<field_name>` - any field in response.value.
+     *
+     * You can combine multiple expressions by enclosing each expression in
+     * parentheses. By default, expressions are combined with AND logic. However,
+     * you can specify AND, OR, and NOT logic explicitly.
+     *
+     * Here are a few examples:
+     *
+     *   * `done:true` - The operation is complete.
+     *   * `(metadata.@type=` \
+     *     `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
+     *     AND` \
+     *     `(metadata.instance_partition.name:custom-instance-partition) AND` \
+     *     `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
+     *     `(error:*)` - Return operations where:
+     *     * The operation's metadata type is
+     *     [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
+     *     * The instance partition name contains "custom-instance-partition".
+     *     * The operation started before 2021-03-28T14:50:00Z.
+     *     * The operation resulted in an error.
+     * 
+ * + * string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearFilter() { + filter_ = getDefaultInstance().getFilter(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. An expression that filters the list of returned operations.
+     *
+     * A filter expression consists of a field name, a
+     * comparison operator, and a value for filtering.
+     * The value must be a string, a number, or a boolean. The comparison operator
+     * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
+     * Colon `:` is the contains operator. Filter rules are not case sensitive.
+     *
+     * The following fields in the [Operation][google.longrunning.Operation]
+     * are eligible for filtering:
+     *
+     *   * `name` - The name of the long-running operation
+     *   * `done` - False if the operation is in progress, else true.
+     *   * `metadata.@type` - the type of metadata. For example, the type string
+     *      for
+     *      [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
+     *      is
+     *      `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
+     *   * `metadata.<field_name>` - any field in metadata.value.
+     *      `metadata.@type` must be specified first, if filtering on metadata
+     *      fields.
+     *   * `error` - Error associated with the long-running operation.
+     *   * `response.@type` - the type of response.
+     *   * `response.<field_name>` - any field in response.value.
+     *
+     * You can combine multiple expressions by enclosing each expression in
+     * parentheses. By default, expressions are combined with AND logic. However,
+     * you can specify AND, OR, and NOT logic explicitly.
+     *
+     * Here are a few examples:
+     *
+     *   * `done:true` - The operation is complete.
+     *   * `(metadata.@type=` \
+     *     `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
+     *     AND` \
+     *     `(metadata.instance_partition.name:custom-instance-partition) AND` \
+     *     `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
+     *     `(error:*)` - Return operations where:
+     *     * The operation's metadata type is
+     *     [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
+     *     * The instance partition name contains "custom-instance-partition".
+     *     * The operation started before 2021-03-28T14:50:00Z.
+     *     * The operation resulted in an error.
+     * 
+ * + * string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for filter to set. + * @return This builder for chaining. + */ + public Builder setFilterBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + filter_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Optional. Number of operations to be returned in the response. If 0 or
+     * less, defaults to the server's maximum allowed page size.
+     * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. Number of operations to be returned in the response. If 0 or
+     * less, defaults to the server's maximum allowed page size.
+     * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Number of operations to be returned in the response. If 0 or
+     * less, defaults to the server's maximum allowed page size.
+     * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + bitField0_ = (bitField0_ & ~0x00000004); + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * Optional. If non-empty, `page_token` should contain a
+     * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]
+     * from a previous
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]
+     * to the same `parent` and with the same `filter`.
+     * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. If non-empty, `page_token` should contain a
+     * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]
+     * from a previous
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]
+     * to the same `parent` and with the same `filter`.
+     * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. If non-empty, `page_token` should contain a
+     * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]
+     * from a previous
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]
+     * to the same `parent` and with the same `filter`.
+     * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + pageToken_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If non-empty, `page_token` should contain a
+     * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]
+     * from a previous
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]
+     * to the same `parent` and with the same `filter`.
+     * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If non-empty, `page_token` should contain a
+     * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]
+     * from a previous
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]
+     * to the same `parent` and with the same `filter`.
+     * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + pageToken_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp instancePartitionDeadline_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + instancePartitionDeadlineBuilder_; + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partition
+     * operations. Instance partitions whose operation metadata cannot be
+     * retrieved within this deadline will be added to
+     * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the instancePartitionDeadline field is set. + */ + public boolean hasInstancePartitionDeadline() { + return ((bitField0_ & 0x00000010) != 0); + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partition
+     * operations. Instance partitions whose operation metadata cannot be
+     * retrieved within this deadline will be added to
+     * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The instancePartitionDeadline. + */ + public com.google.protobuf.Timestamp getInstancePartitionDeadline() { + if (instancePartitionDeadlineBuilder_ == null) { + return instancePartitionDeadline_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : instancePartitionDeadline_; + } else { + return instancePartitionDeadlineBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partition
+     * operations. Instance partitions whose operation metadata cannot be
+     * retrieved within this deadline will be added to
+     * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setInstancePartitionDeadline(com.google.protobuf.Timestamp value) { + if (instancePartitionDeadlineBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + instancePartitionDeadline_ = value; + } else { + instancePartitionDeadlineBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partition
+     * operations. Instance partitions whose operation metadata cannot be
+     * retrieved within this deadline will be added to
+     * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setInstancePartitionDeadline( + com.google.protobuf.Timestamp.Builder builderForValue) { + if (instancePartitionDeadlineBuilder_ == null) { + instancePartitionDeadline_ = builderForValue.build(); + } else { + instancePartitionDeadlineBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partition
+     * operations. Instance partitions whose operation metadata cannot be
+     * retrieved within this deadline will be added to
+     * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeInstancePartitionDeadline(com.google.protobuf.Timestamp value) { + if (instancePartitionDeadlineBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0) + && instancePartitionDeadline_ != null + && instancePartitionDeadline_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getInstancePartitionDeadlineBuilder().mergeFrom(value); + } else { + instancePartitionDeadline_ = value; + } + } else { + instancePartitionDeadlineBuilder_.mergeFrom(value); + } + if (instancePartitionDeadline_ != null) { + bitField0_ |= 0x00000010; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partition
+     * operations. Instance partitions whose operation metadata cannot be
+     * retrieved within this deadline will be added to
+     * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearInstancePartitionDeadline() { + bitField0_ = (bitField0_ & ~0x00000010); + instancePartitionDeadline_ = null; + if (instancePartitionDeadlineBuilder_ != null) { + instancePartitionDeadlineBuilder_.dispose(); + instancePartitionDeadlineBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partition
+     * operations. Instance partitions whose operation metadata cannot be
+     * retrieved within this deadline will be added to
+     * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.Timestamp.Builder getInstancePartitionDeadlineBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return getInstancePartitionDeadlineFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partition
+     * operations. Instance partitions whose operation metadata cannot be
+     * retrieved within this deadline will be added to
+     * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.TimestampOrBuilder getInstancePartitionDeadlineOrBuilder() { + if (instancePartitionDeadlineBuilder_ != null) { + return instancePartitionDeadlineBuilder_.getMessageOrBuilder(); + } else { + return instancePartitionDeadline_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : instancePartitionDeadline_; + } + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partition
+     * operations. Instance partitions whose operation metadata cannot be
+     * retrieved within this deadline will be added to
+     * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+     * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getInstancePartitionDeadlineFieldBuilder() { + if (instancePartitionDeadlineBuilder_ == null) { + instancePartitionDeadlineBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getInstancePartitionDeadline(), getParentForChildren(), isClean()); + instancePartitionDeadline_ = null; + } + return instancePartitionDeadlineBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest) + private static final com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest(); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListInstancePartitionOperationsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsRequestOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsRequestOrBuilder.java new file mode 100644 index 00000000000..e6f3e31013f --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsRequestOrBuilder.java @@ -0,0 +1,266 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +public interface ListInstancePartitionOperationsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The parent instance of the instance partition operations.
+   * Values are of the form `projects/<project>/instances/<instance>`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The parent instance of the instance partition operations.
+   * Values are of the form `projects/<project>/instances/<instance>`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Optional. An expression that filters the list of returned operations.
+   *
+   * A filter expression consists of a field name, a
+   * comparison operator, and a value for filtering.
+   * The value must be a string, a number, or a boolean. The comparison operator
+   * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
+   * Colon `:` is the contains operator. Filter rules are not case sensitive.
+   *
+   * The following fields in the [Operation][google.longrunning.Operation]
+   * are eligible for filtering:
+   *
+   *   * `name` - The name of the long-running operation
+   *   * `done` - False if the operation is in progress, else true.
+   *   * `metadata.@type` - the type of metadata. For example, the type string
+   *      for
+   *      [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
+   *      is
+   *      `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
+   *   * `metadata.<field_name>` - any field in metadata.value.
+   *      `metadata.@type` must be specified first, if filtering on metadata
+   *      fields.
+   *   * `error` - Error associated with the long-running operation.
+   *   * `response.@type` - the type of response.
+   *   * `response.<field_name>` - any field in response.value.
+   *
+   * You can combine multiple expressions by enclosing each expression in
+   * parentheses. By default, expressions are combined with AND logic. However,
+   * you can specify AND, OR, and NOT logic explicitly.
+   *
+   * Here are a few examples:
+   *
+   *   * `done:true` - The operation is complete.
+   *   * `(metadata.@type=` \
+   *     `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
+   *     AND` \
+   *     `(metadata.instance_partition.name:custom-instance-partition) AND` \
+   *     `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
+   *     `(error:*)` - Return operations where:
+   *     * The operation's metadata type is
+   *     [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
+   *     * The instance partition name contains "custom-instance-partition".
+   *     * The operation started before 2021-03-28T14:50:00Z.
+   *     * The operation resulted in an error.
+   * 
+ * + * string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The filter. + */ + java.lang.String getFilter(); + /** + * + * + *
+   * Optional. An expression that filters the list of returned operations.
+   *
+   * A filter expression consists of a field name, a
+   * comparison operator, and a value for filtering.
+   * The value must be a string, a number, or a boolean. The comparison operator
+   * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
+   * Colon `:` is the contains operator. Filter rules are not case sensitive.
+   *
+   * The following fields in the [Operation][google.longrunning.Operation]
+   * are eligible for filtering:
+   *
+   *   * `name` - The name of the long-running operation
+   *   * `done` - False if the operation is in progress, else true.
+   *   * `metadata.@type` - the type of metadata. For example, the type string
+   *      for
+   *      [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
+   *      is
+   *      `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
+   *   * `metadata.<field_name>` - any field in metadata.value.
+   *      `metadata.@type` must be specified first, if filtering on metadata
+   *      fields.
+   *   * `error` - Error associated with the long-running operation.
+   *   * `response.@type` - the type of response.
+   *   * `response.<field_name>` - any field in response.value.
+   *
+   * You can combine multiple expressions by enclosing each expression in
+   * parentheses. By default, expressions are combined with AND logic. However,
+   * you can specify AND, OR, and NOT logic explicitly.
+   *
+   * Here are a few examples:
+   *
+   *   * `done:true` - The operation is complete.
+   *   * `(metadata.@type=` \
+   *     `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
+   *     AND` \
+   *     `(metadata.instance_partition.name:custom-instance-partition) AND` \
+   *     `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
+   *     `(error:*)` - Return operations where:
+   *     * The operation's metadata type is
+   *     [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
+   *     * The instance partition name contains "custom-instance-partition".
+   *     * The operation started before 2021-03-28T14:50:00Z.
+   *     * The operation resulted in an error.
+   * 
+ * + * string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for filter. + */ + com.google.protobuf.ByteString getFilterBytes(); + + /** + * + * + *
+   * Optional. Number of operations to be returned in the response. If 0 or
+   * less, defaults to the server's maximum allowed page size.
+   * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. If non-empty, `page_token` should contain a
+   * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]
+   * from a previous
+   * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]
+   * to the same `parent` and with the same `filter`.
+   * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. If non-empty, `page_token` should contain a
+   * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]
+   * from a previous
+   * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]
+   * to the same `parent` and with the same `filter`.
+   * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * Optional. Deadline used while retrieving metadata for instance partition
+   * operations. Instance partitions whose operation metadata cannot be
+   * retrieved within this deadline will be added to
+   * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+   * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+   * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the instancePartitionDeadline field is set. + */ + boolean hasInstancePartitionDeadline(); + /** + * + * + *
+   * Optional. Deadline used while retrieving metadata for instance partition
+   * operations. Instance partitions whose operation metadata cannot be
+   * retrieved within this deadline will be added to
+   * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+   * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+   * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The instancePartitionDeadline. + */ + com.google.protobuf.Timestamp getInstancePartitionDeadline(); + /** + * + * + *
+   * Optional. Deadline used while retrieving metadata for instance partition
+   * operations. Instance partitions whose operation metadata cannot be
+   * retrieved within this deadline will be added to
+   * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
+   * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
+   * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.TimestampOrBuilder getInstancePartitionDeadlineOrBuilder(); +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsResponse.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsResponse.java new file mode 100644 index 00000000000..847e20cd187 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsResponse.java @@ -0,0 +1,1571 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +/** + * + * + *
+ * The response for
+ * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations].
+ * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse} + */ +public final class ListInstancePartitionOperationsResponse + extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse) + ListInstancePartitionOperationsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListInstancePartitionOperationsResponse.newBuilder() to construct. + private ListInstancePartitionOperationsResponse( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListInstancePartitionOperationsResponse() { + operations_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + unreachableInstancePartitions_ = com.google.protobuf.LazyStringArrayList.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListInstancePartitionOperationsResponse(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.class, + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.Builder + .class); + } + + public static final int OPERATIONS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private java.util.List operations_; + /** + * + * + *
+   * The list of matching instance partition [long-running
+   * operations][google.longrunning.Operation]. Each operation's name will be
+   * prefixed by the instance partition's name. The operation's
+   * [metadata][google.longrunning.Operation.metadata] field type
+   * `metadata.type_url` describes the type of the metadata.
+   * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + @java.lang.Override + public java.util.List getOperationsList() { + return operations_; + } + /** + * + * + *
+   * The list of matching instance partition [long-running
+   * operations][google.longrunning.Operation]. Each operation's name will be
+   * prefixed by the instance partition's name. The operation's
+   * [metadata][google.longrunning.Operation.metadata] field type
+   * `metadata.type_url` describes the type of the metadata.
+   * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + @java.lang.Override + public java.util.List + getOperationsOrBuilderList() { + return operations_; + } + /** + * + * + *
+   * The list of matching instance partition [long-running
+   * operations][google.longrunning.Operation]. Each operation's name will be
+   * prefixed by the instance partition's name. The operation's
+   * [metadata][google.longrunning.Operation.metadata] field type
+   * `metadata.type_url` describes the type of the metadata.
+   * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + @java.lang.Override + public int getOperationsCount() { + return operations_.size(); + } + /** + * + * + *
+   * The list of matching instance partition [long-running
+   * operations][google.longrunning.Operation]. Each operation's name will be
+   * prefixed by the instance partition's name. The operation's
+   * [metadata][google.longrunning.Operation.metadata] field type
+   * `metadata.type_url` describes the type of the metadata.
+   * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + @java.lang.Override + public com.google.longrunning.Operation getOperations(int index) { + return operations_.get(index); + } + /** + * + * + *
+   * The list of matching instance partition [long-running
+   * operations][google.longrunning.Operation]. Each operation's name will be
+   * prefixed by the instance partition's name. The operation's
+   * [metadata][google.longrunning.Operation.metadata] field type
+   * `metadata.type_url` describes the type of the metadata.
+   * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + @java.lang.Override + public com.google.longrunning.OperationOrBuilder getOperationsOrBuilder(int index) { + return operations_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+   * `next_page_token` can be sent in a subsequent
+   * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]
+   * call to fetch more of the matching metadata.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + 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(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * `next_page_token` can be sent in a subsequent
+   * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]
+   * call to fetch more of the matching metadata.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UNREACHABLE_INSTANCE_PARTITIONS_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList unreachableInstancePartitions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose operation metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @return A list containing the unreachableInstancePartitions. + */ + public com.google.protobuf.ProtocolStringList getUnreachableInstancePartitionsList() { + return unreachableInstancePartitions_; + } + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose operation metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @return The count of unreachableInstancePartitions. + */ + public int getUnreachableInstancePartitionsCount() { + return unreachableInstancePartitions_.size(); + } + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose operation metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @param index The index of the element to return. + * @return The unreachableInstancePartitions at the given index. + */ + public java.lang.String getUnreachableInstancePartitions(int index) { + return unreachableInstancePartitions_.get(index); + } + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose operation metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachableInstancePartitions at the given index. + */ + public com.google.protobuf.ByteString getUnreachableInstancePartitionsBytes(int index) { + return unreachableInstancePartitions_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < operations_.size(); i++) { + output.writeMessage(1, operations_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + for (int i = 0; i < unreachableInstancePartitions_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString( + output, 3, unreachableInstancePartitions_.getRaw(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < operations_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, operations_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + { + int dataSize = 0; + for (int i = 0; i < unreachableInstancePartitions_.size(); i++) { + dataSize += computeStringSizeNoTag(unreachableInstancePartitions_.getRaw(i)); + } + size += dataSize; + size += 1 * getUnreachableInstancePartitionsList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse other = + (com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse) obj; + + if (!getOperationsList().equals(other.getOperationsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!getUnreachableInstancePartitionsList() + .equals(other.getUnreachableInstancePartitionsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getOperationsCount() > 0) { + hash = (37 * hash) + OPERATIONS_FIELD_NUMBER; + hash = (53 * hash) + getOperationsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + if (getUnreachableInstancePartitionsCount() > 0) { + hash = (37 * hash) + UNREACHABLE_INSTANCE_PARTITIONS_FIELD_NUMBER; + hash = (53 * hash) + getUnreachableInstancePartitionsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The response for
+   * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations].
+   * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse) + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.class, + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.Builder + .class); + } + + // Construct using + // com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (operationsBuilder_ == null) { + operations_ = java.util.Collections.emptyList(); + } else { + operations_ = null; + operationsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + nextPageToken_ = ""; + unreachableInstancePartitions_ = com.google.protobuf.LazyStringArrayList.emptyList(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsResponse_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse build() { + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + buildPartial() { + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse result = + new com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse result) { + if (operationsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + operations_ = java.util.Collections.unmodifiableList(operations_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.operations_ = operations_; + } else { + result.operations_ = operationsBuilder_.build(); + } + } + + private void buildPartial0( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + unreachableInstancePartitions_.makeImmutable(); + result.unreachableInstancePartitions_ = unreachableInstancePartitions_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse) { + return mergeFrom( + (com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse other) { + if (other + == com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + .getDefaultInstance()) return this; + if (operationsBuilder_ == null) { + if (!other.operations_.isEmpty()) { + if (operations_.isEmpty()) { + operations_ = other.operations_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureOperationsIsMutable(); + operations_.addAll(other.operations_); + } + onChanged(); + } + } else { + if (!other.operations_.isEmpty()) { + if (operationsBuilder_.isEmpty()) { + operationsBuilder_.dispose(); + operationsBuilder_ = null; + operations_ = other.operations_; + bitField0_ = (bitField0_ & ~0x00000001); + operationsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getOperationsFieldBuilder() + : null; + } else { + operationsBuilder_.addAllMessages(other.operations_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.unreachableInstancePartitions_.isEmpty()) { + if (unreachableInstancePartitions_.isEmpty()) { + unreachableInstancePartitions_ = other.unreachableInstancePartitions_; + bitField0_ |= 0x00000004; + } else { + ensureUnreachableInstancePartitionsIsMutable(); + unreachableInstancePartitions_.addAll(other.unreachableInstancePartitions_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.longrunning.Operation m = + input.readMessage(com.google.longrunning.Operation.parser(), extensionRegistry); + if (operationsBuilder_ == null) { + ensureOperationsIsMutable(); + operations_.add(m); + } else { + operationsBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureUnreachableInstancePartitionsIsMutable(); + unreachableInstancePartitions_.add(s); + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List operations_ = + java.util.Collections.emptyList(); + + private void ensureOperationsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + operations_ = new java.util.ArrayList(operations_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.longrunning.Operation, + com.google.longrunning.Operation.Builder, + com.google.longrunning.OperationOrBuilder> + operationsBuilder_; + + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public java.util.List getOperationsList() { + if (operationsBuilder_ == null) { + return java.util.Collections.unmodifiableList(operations_); + } else { + return operationsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public int getOperationsCount() { + if (operationsBuilder_ == null) { + return operations_.size(); + } else { + return operationsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public com.google.longrunning.Operation getOperations(int index) { + if (operationsBuilder_ == null) { + return operations_.get(index); + } else { + return operationsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public Builder setOperations(int index, com.google.longrunning.Operation value) { + if (operationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOperationsIsMutable(); + operations_.set(index, value); + onChanged(); + } else { + operationsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public Builder setOperations( + int index, com.google.longrunning.Operation.Builder builderForValue) { + if (operationsBuilder_ == null) { + ensureOperationsIsMutable(); + operations_.set(index, builderForValue.build()); + onChanged(); + } else { + operationsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public Builder addOperations(com.google.longrunning.Operation value) { + if (operationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOperationsIsMutable(); + operations_.add(value); + onChanged(); + } else { + operationsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public Builder addOperations(int index, com.google.longrunning.Operation value) { + if (operationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOperationsIsMutable(); + operations_.add(index, value); + onChanged(); + } else { + operationsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public Builder addOperations(com.google.longrunning.Operation.Builder builderForValue) { + if (operationsBuilder_ == null) { + ensureOperationsIsMutable(); + operations_.add(builderForValue.build()); + onChanged(); + } else { + operationsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public Builder addOperations( + int index, com.google.longrunning.Operation.Builder builderForValue) { + if (operationsBuilder_ == null) { + ensureOperationsIsMutable(); + operations_.add(index, builderForValue.build()); + onChanged(); + } else { + operationsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public Builder addAllOperations( + java.lang.Iterable values) { + if (operationsBuilder_ == null) { + ensureOperationsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, operations_); + onChanged(); + } else { + operationsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public Builder clearOperations() { + if (operationsBuilder_ == null) { + operations_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + operationsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public Builder removeOperations(int index) { + if (operationsBuilder_ == null) { + ensureOperationsIsMutable(); + operations_.remove(index); + onChanged(); + } else { + operationsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public com.google.longrunning.Operation.Builder getOperationsBuilder(int index) { + return getOperationsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public com.google.longrunning.OperationOrBuilder getOperationsOrBuilder(int index) { + if (operationsBuilder_ == null) { + return operations_.get(index); + } else { + return operationsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public java.util.List + getOperationsOrBuilderList() { + if (operationsBuilder_ != null) { + return operationsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(operations_); + } + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public com.google.longrunning.Operation.Builder addOperationsBuilder() { + return getOperationsFieldBuilder() + .addBuilder(com.google.longrunning.Operation.getDefaultInstance()); + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public com.google.longrunning.Operation.Builder addOperationsBuilder(int index) { + return getOperationsFieldBuilder() + .addBuilder(index, com.google.longrunning.Operation.getDefaultInstance()); + } + /** + * + * + *
+     * The list of matching instance partition [long-running
+     * operations][google.longrunning.Operation]. Each operation's name will be
+     * prefixed by the instance partition's name. The operation's
+     * [metadata][google.longrunning.Operation.metadata] field type
+     * `metadata.type_url` describes the type of the metadata.
+     * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + public java.util.List getOperationsBuilderList() { + return getOperationsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.longrunning.Operation, + com.google.longrunning.Operation.Builder, + com.google.longrunning.OperationOrBuilder> + getOperationsFieldBuilder() { + if (operationsBuilder_ == null) { + operationsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.longrunning.Operation, + com.google.longrunning.Operation.Builder, + com.google.longrunning.OperationOrBuilder>( + operations_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + operations_ = null; + } + return operationsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * `next_page_token` can be sent in a subsequent
+     * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]
+     * call to fetch more of the matching metadata.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * `next_page_token` can be sent in a subsequent
+     * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]
+     * call to fetch more of the matching metadata.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * `next_page_token` can be sent in a subsequent
+     * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]
+     * call to fetch more of the matching metadata.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * `next_page_token` can be sent in a subsequent
+     * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]
+     * call to fetch more of the matching metadata.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * `next_page_token` can be sent in a subsequent
+     * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]
+     * call to fetch more of the matching metadata.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList unreachableInstancePartitions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureUnreachableInstancePartitionsIsMutable() { + if (!unreachableInstancePartitions_.isModifiable()) { + unreachableInstancePartitions_ = + new com.google.protobuf.LazyStringArrayList(unreachableInstancePartitions_); + } + bitField0_ |= 0x00000004; + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose operation metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @return A list containing the unreachableInstancePartitions. + */ + public com.google.protobuf.ProtocolStringList getUnreachableInstancePartitionsList() { + unreachableInstancePartitions_.makeImmutable(); + return unreachableInstancePartitions_; + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose operation metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @return The count of unreachableInstancePartitions. + */ + public int getUnreachableInstancePartitionsCount() { + return unreachableInstancePartitions_.size(); + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose operation metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @param index The index of the element to return. + * @return The unreachableInstancePartitions at the given index. + */ + public java.lang.String getUnreachableInstancePartitions(int index) { + return unreachableInstancePartitions_.get(index); + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose operation metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachableInstancePartitions at the given index. + */ + public com.google.protobuf.ByteString getUnreachableInstancePartitionsBytes(int index) { + return unreachableInstancePartitions_.getByteString(index); + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose operation metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @param index The index to set the value at. + * @param value The unreachableInstancePartitions to set. + * @return This builder for chaining. + */ + public Builder setUnreachableInstancePartitions(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureUnreachableInstancePartitionsIsMutable(); + unreachableInstancePartitions_.set(index, value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose operation metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @param value The unreachableInstancePartitions to add. + * @return This builder for chaining. + */ + public Builder addUnreachableInstancePartitions(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureUnreachableInstancePartitionsIsMutable(); + unreachableInstancePartitions_.add(value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose operation metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @param values The unreachableInstancePartitions to add. + * @return This builder for chaining. + */ + public Builder addAllUnreachableInstancePartitions( + java.lang.Iterable values) { + ensureUnreachableInstancePartitionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, unreachableInstancePartitions_); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose operation metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @return This builder for chaining. + */ + public Builder clearUnreachableInstancePartitions() { + unreachableInstancePartitions_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + ; + onChanged(); + return this; + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose operation metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @param value The bytes of the unreachableInstancePartitions to add. + * @return This builder for chaining. + */ + public Builder addUnreachableInstancePartitionsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureUnreachableInstancePartitionsIsMutable(); + unreachableInstancePartitions_.add(value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse) + private static final com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse(); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListInstancePartitionOperationsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsResponseOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsResponseOrBuilder.java new file mode 100644 index 00000000000..f0d7b224276 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionOperationsResponseOrBuilder.java @@ -0,0 +1,189 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +public interface ListInstancePartitionOperationsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The list of matching instance partition [long-running
+   * operations][google.longrunning.Operation]. Each operation's name will be
+   * prefixed by the instance partition's name. The operation's
+   * [metadata][google.longrunning.Operation.metadata] field type
+   * `metadata.type_url` describes the type of the metadata.
+   * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + java.util.List getOperationsList(); + /** + * + * + *
+   * The list of matching instance partition [long-running
+   * operations][google.longrunning.Operation]. Each operation's name will be
+   * prefixed by the instance partition's name. The operation's
+   * [metadata][google.longrunning.Operation.metadata] field type
+   * `metadata.type_url` describes the type of the metadata.
+   * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + com.google.longrunning.Operation getOperations(int index); + /** + * + * + *
+   * The list of matching instance partition [long-running
+   * operations][google.longrunning.Operation]. Each operation's name will be
+   * prefixed by the instance partition's name. The operation's
+   * [metadata][google.longrunning.Operation.metadata] field type
+   * `metadata.type_url` describes the type of the metadata.
+   * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + int getOperationsCount(); + /** + * + * + *
+   * The list of matching instance partition [long-running
+   * operations][google.longrunning.Operation]. Each operation's name will be
+   * prefixed by the instance partition's name. The operation's
+   * [metadata][google.longrunning.Operation.metadata] field type
+   * `metadata.type_url` describes the type of the metadata.
+   * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + java.util.List getOperationsOrBuilderList(); + /** + * + * + *
+   * The list of matching instance partition [long-running
+   * operations][google.longrunning.Operation]. Each operation's name will be
+   * prefixed by the instance partition's name. The operation's
+   * [metadata][google.longrunning.Operation.metadata] field type
+   * `metadata.type_url` describes the type of the metadata.
+   * 
+ * + * repeated .google.longrunning.Operation operations = 1; + */ + com.google.longrunning.OperationOrBuilder getOperationsOrBuilder(int index); + + /** + * + * + *
+   * `next_page_token` can be sent in a subsequent
+   * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]
+   * call to fetch more of the matching metadata.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * `next_page_token` can be sent in a subsequent
+   * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]
+   * call to fetch more of the matching metadata.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); + + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose operation metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @return A list containing the unreachableInstancePartitions. + */ + java.util.List getUnreachableInstancePartitionsList(); + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose operation metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @return The count of unreachableInstancePartitions. + */ + int getUnreachableInstancePartitionsCount(); + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose operation metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @param index The index of the element to return. + * @return The unreachableInstancePartitions at the given index. + */ + java.lang.String getUnreachableInstancePartitions(int index); + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose operation metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable_instance_partitions = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachableInstancePartitions at the given index. + */ + com.google.protobuf.ByteString getUnreachableInstancePartitionsBytes(int index); +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsRequest.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsRequest.java new file mode 100644 index 00000000000..617de48ebe3 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsRequest.java @@ -0,0 +1,1331 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +/** + * + * + *
+ * The request for
+ * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions].
+ * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.ListInstancePartitionsRequest} + */ +public final class ListInstancePartitionsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.ListInstancePartitionsRequest) + ListInstancePartitionsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListInstancePartitionsRequest.newBuilder() to construct. + private ListInstancePartitionsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListInstancePartitionsRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListInstancePartitionsRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest.class, + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest.Builder.class); + } + + private int bitField0_; + public static final int PARENT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + * + * + *
+   * Required. The instance whose instance partitions should be listed. Values
+   * are of the form `projects/<project>/instances/<instance>`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + 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(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The instance whose instance partitions should be listed. Values
+   * are of the form `projects/<project>/instances/<instance>`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_ = 0; + /** + * + * + *
+   * Number of instance partitions to be returned in the response. If 0 or less,
+   * defaults to the server's maximum allowed page size.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + /** + * + * + *
+   * If non-empty, `page_token` should contain a
+   * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]
+   * from a previous
+   * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + 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(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * If non-empty, `page_token` should contain a
+   * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]
+   * from a previous
+   * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INSTANCE_PARTITION_DEADLINE_FIELD_NUMBER = 4; + private com.google.protobuf.Timestamp instancePartitionDeadline_; + /** + * + * + *
+   * Optional. Deadline used while retrieving metadata for instance partitions.
+   * Instance partitions whose metadata cannot be retrieved within this deadline
+   * will be added to
+   * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+   * in
+   * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+   * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the instancePartitionDeadline field is set. + */ + @java.lang.Override + public boolean hasInstancePartitionDeadline() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Optional. Deadline used while retrieving metadata for instance partitions.
+   * Instance partitions whose metadata cannot be retrieved within this deadline
+   * will be added to
+   * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+   * in
+   * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+   * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The instancePartitionDeadline. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getInstancePartitionDeadline() { + return instancePartitionDeadline_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : instancePartitionDeadline_; + } + /** + * + * + *
+   * Optional. Deadline used while retrieving metadata for instance partitions.
+   * Instance partitions whose metadata cannot be retrieved within this deadline
+   * will be added to
+   * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+   * in
+   * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+   * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getInstancePartitionDeadlineOrBuilder() { + return instancePartitionDeadline_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : instancePartitionDeadline_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(4, getInstancePartitionDeadline()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 4, getInstancePartitionDeadline()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest other = + (com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (hasInstancePartitionDeadline() != other.hasInstancePartitionDeadline()) return false; + if (hasInstancePartitionDeadline()) { + if (!getInstancePartitionDeadline().equals(other.getInstancePartitionDeadline())) + return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + if (hasInstancePartitionDeadline()) { + hash = (37 * hash) + INSTANCE_PARTITION_DEADLINE_FIELD_NUMBER; + hash = (53 * hash) + getInstancePartitionDeadline().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request for
+   * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions].
+   * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.ListInstancePartitionsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.ListInstancePartitionsRequest) + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest.class, + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest.Builder.class); + } + + // Construct using + // com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getInstancePartitionDeadlineFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + pageSize_ = 0; + pageToken_ = ""; + instancePartitionDeadline_ = null; + if (instancePartitionDeadlineBuilder_ != null) { + instancePartitionDeadlineBuilder_.dispose(); + instancePartitionDeadlineBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsRequest_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest + getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest build() { + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest buildPartial() { + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest result = + new com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageToken_ = pageToken_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000008) != 0)) { + result.instancePartitionDeadline_ = + instancePartitionDeadlineBuilder_ == null + ? instancePartitionDeadline_ + : instancePartitionDeadlineBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest) { + return mergeFrom( + (com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest other) { + if (other + == com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest + .getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (other.hasInstancePartitionDeadline()) { + mergeInstancePartitionDeadline(other.getInstancePartitionDeadline()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: + { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + input.readMessage( + getInstancePartitionDeadlineFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The instance whose instance partitions should be listed. Values
+     * are of the form `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The instance whose instance partitions should be listed. Values
+     * are of the form `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The instance whose instance partitions should be listed. Values
+     * are of the form `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The instance whose instance partitions should be listed. Values
+     * are of the form `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The instance whose instance partitions should be listed. Values
+     * are of the form `projects/<project>/instances/<instance>`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Number of instance partitions to be returned in the response. If 0 or less,
+     * defaults to the server's maximum allowed page size.
+     * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Number of instance partitions to be returned in the response. If 0 or less,
+     * defaults to the server's maximum allowed page size.
+     * 
+ * + * int32 page_size = 2; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Number of instance partitions to be returned in the response. If 0 or less,
+     * defaults to the server's maximum allowed page size.
+     * 
+ * + * int32 page_size = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + bitField0_ = (bitField0_ & ~0x00000002); + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * If non-empty, `page_token` should contain a
+     * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]
+     * from a previous
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * If non-empty, `page_token` should contain a
+     * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]
+     * from a previous
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * If non-empty, `page_token` should contain a
+     * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]
+     * from a previous
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * string page_token = 3; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + pageToken_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * If non-empty, `page_token` should contain a
+     * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]
+     * from a previous
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * If non-empty, `page_token` should contain a
+     * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]
+     * from a previous
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * string page_token = 3; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + pageToken_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp instancePartitionDeadline_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + instancePartitionDeadlineBuilder_; + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partitions.
+     * Instance partitions whose metadata cannot be retrieved within this deadline
+     * will be added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+     * in
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the instancePartitionDeadline field is set. + */ + public boolean hasInstancePartitionDeadline() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partitions.
+     * Instance partitions whose metadata cannot be retrieved within this deadline
+     * will be added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+     * in
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The instancePartitionDeadline. + */ + public com.google.protobuf.Timestamp getInstancePartitionDeadline() { + if (instancePartitionDeadlineBuilder_ == null) { + return instancePartitionDeadline_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : instancePartitionDeadline_; + } else { + return instancePartitionDeadlineBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partitions.
+     * Instance partitions whose metadata cannot be retrieved within this deadline
+     * will be added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+     * in
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setInstancePartitionDeadline(com.google.protobuf.Timestamp value) { + if (instancePartitionDeadlineBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + instancePartitionDeadline_ = value; + } else { + instancePartitionDeadlineBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partitions.
+     * Instance partitions whose metadata cannot be retrieved within this deadline
+     * will be added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+     * in
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setInstancePartitionDeadline( + com.google.protobuf.Timestamp.Builder builderForValue) { + if (instancePartitionDeadlineBuilder_ == null) { + instancePartitionDeadline_ = builderForValue.build(); + } else { + instancePartitionDeadlineBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partitions.
+     * Instance partitions whose metadata cannot be retrieved within this deadline
+     * will be added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+     * in
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeInstancePartitionDeadline(com.google.protobuf.Timestamp value) { + if (instancePartitionDeadlineBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) + && instancePartitionDeadline_ != null + && instancePartitionDeadline_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getInstancePartitionDeadlineBuilder().mergeFrom(value); + } else { + instancePartitionDeadline_ = value; + } + } else { + instancePartitionDeadlineBuilder_.mergeFrom(value); + } + if (instancePartitionDeadline_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partitions.
+     * Instance partitions whose metadata cannot be retrieved within this deadline
+     * will be added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+     * in
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearInstancePartitionDeadline() { + bitField0_ = (bitField0_ & ~0x00000008); + instancePartitionDeadline_ = null; + if (instancePartitionDeadlineBuilder_ != null) { + instancePartitionDeadlineBuilder_.dispose(); + instancePartitionDeadlineBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partitions.
+     * Instance partitions whose metadata cannot be retrieved within this deadline
+     * will be added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+     * in
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.Timestamp.Builder getInstancePartitionDeadlineBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getInstancePartitionDeadlineFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partitions.
+     * Instance partitions whose metadata cannot be retrieved within this deadline
+     * will be added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+     * in
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.TimestampOrBuilder getInstancePartitionDeadlineOrBuilder() { + if (instancePartitionDeadlineBuilder_ != null) { + return instancePartitionDeadlineBuilder_.getMessageOrBuilder(); + } else { + return instancePartitionDeadline_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : instancePartitionDeadline_; + } + } + /** + * + * + *
+     * Optional. Deadline used while retrieving metadata for instance partitions.
+     * Instance partitions whose metadata cannot be retrieved within this deadline
+     * will be added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+     * in
+     * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+     * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getInstancePartitionDeadlineFieldBuilder() { + if (instancePartitionDeadlineBuilder_ == null) { + instancePartitionDeadlineBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getInstancePartitionDeadline(), getParentForChildren(), isClean()); + instancePartitionDeadline_ = null; + } + return instancePartitionDeadlineBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.ListInstancePartitionsRequest) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.ListInstancePartitionsRequest) + private static final com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest(); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListInstancePartitionsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionsRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsRequestOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsRequestOrBuilder.java new file mode 100644 index 00000000000..4258e48f6ad --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsRequestOrBuilder.java @@ -0,0 +1,158 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +public interface ListInstancePartitionsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.ListInstancePartitionsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The instance whose instance partitions should be listed. Values
+   * are of the form `projects/<project>/instances/<instance>`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The instance whose instance partitions should be listed. Values
+   * are of the form `projects/<project>/instances/<instance>`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Number of instance partitions to be returned in the response. If 0 or less,
+   * defaults to the server's maximum allowed page size.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * If non-empty, `page_token` should contain a
+   * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]
+   * from a previous
+   * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * If non-empty, `page_token` should contain a
+   * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]
+   * from a previous
+   * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * Optional. Deadline used while retrieving metadata for instance partitions.
+   * Instance partitions whose metadata cannot be retrieved within this deadline
+   * will be added to
+   * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+   * in
+   * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+   * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the instancePartitionDeadline field is set. + */ + boolean hasInstancePartitionDeadline(); + /** + * + * + *
+   * Optional. Deadline used while retrieving metadata for instance partitions.
+   * Instance partitions whose metadata cannot be retrieved within this deadline
+   * will be added to
+   * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+   * in
+   * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+   * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The instancePartitionDeadline. + */ + com.google.protobuf.Timestamp getInstancePartitionDeadline(); + /** + * + * + *
+   * Optional. Deadline used while retrieving metadata for instance partitions.
+   * Instance partitions whose metadata cannot be retrieved within this deadline
+   * will be added to
+   * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
+   * in
+   * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
+   * 
+ * + * + * .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.TimestampOrBuilder getInstancePartitionDeadlineOrBuilder(); +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsResponse.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsResponse.java new file mode 100644 index 00000000000..12de299c491 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsResponse.java @@ -0,0 +1,1507 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +/** + * + * + *
+ * The response for
+ * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions].
+ * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.ListInstancePartitionsResponse} + */ +public final class ListInstancePartitionsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.ListInstancePartitionsResponse) + ListInstancePartitionsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListInstancePartitionsResponse.newBuilder() to construct. + private ListInstancePartitionsResponse( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListInstancePartitionsResponse() { + instancePartitions_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + unreachable_ = com.google.protobuf.LazyStringArrayList.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListInstancePartitionsResponse(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.class, + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.Builder.class); + } + + public static final int INSTANCE_PARTITIONS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private java.util.List + instancePartitions_; + /** + * + * + *
+   * The list of requested instancePartitions.
+   * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + @java.lang.Override + public java.util.List + getInstancePartitionsList() { + return instancePartitions_; + } + /** + * + * + *
+   * The list of requested instancePartitions.
+   * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + @java.lang.Override + public java.util.List + getInstancePartitionsOrBuilderList() { + return instancePartitions_; + } + /** + * + * + *
+   * The list of requested instancePartitions.
+   * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + @java.lang.Override + public int getInstancePartitionsCount() { + return instancePartitions_.size(); + } + /** + * + * + *
+   * The list of requested instancePartitions.
+   * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartition getInstancePartitions(int index) { + return instancePartitions_.get(index); + } + /** + * + * + *
+   * The list of requested instancePartitions.
+   * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder + getInstancePartitionsOrBuilder(int index) { + return instancePartitions_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+   * `next_page_token` can be sent in a subsequent
+   * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]
+   * call to fetch more of the matching instance partitions.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + 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(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * `next_page_token` can be sent in a subsequent
+   * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]
+   * call to fetch more of the matching instance partitions.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UNREACHABLE_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList unreachable_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @return A list containing the unreachable. + */ + public com.google.protobuf.ProtocolStringList getUnreachableList() { + return unreachable_; + } + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @return The count of unreachable. + */ + public int getUnreachableCount() { + return unreachable_.size(); + } + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the element to return. + * @return The unreachable at the given index. + */ + public java.lang.String getUnreachable(int index) { + return unreachable_.get(index); + } + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachable at the given index. + */ + public com.google.protobuf.ByteString getUnreachableBytes(int index) { + return unreachable_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < instancePartitions_.size(); i++) { + output.writeMessage(1, instancePartitions_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + for (int i = 0; i < unreachable_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, unreachable_.getRaw(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < instancePartitions_.size(); i++) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(1, instancePartitions_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + { + int dataSize = 0; + for (int i = 0; i < unreachable_.size(); i++) { + dataSize += computeStringSizeNoTag(unreachable_.getRaw(i)); + } + size += dataSize; + size += 1 * getUnreachableList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse other = + (com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse) obj; + + if (!getInstancePartitionsList().equals(other.getInstancePartitionsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!getUnreachableList().equals(other.getUnreachableList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getInstancePartitionsCount() > 0) { + hash = (37 * hash) + INSTANCE_PARTITIONS_FIELD_NUMBER; + hash = (53 * hash) + getInstancePartitionsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + if (getUnreachableCount() > 0) { + hash = (37 * hash) + UNREACHABLE_FIELD_NUMBER; + hash = (53 * hash) + getUnreachableList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The response for
+   * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions].
+   * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.ListInstancePartitionsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.ListInstancePartitionsResponse) + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.class, + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.Builder.class); + } + + // Construct using + // com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (instancePartitionsBuilder_ == null) { + instancePartitions_ = java.util.Collections.emptyList(); + } else { + instancePartitions_ = null; + instancePartitionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + nextPageToken_ = ""; + unreachable_ = com.google.protobuf.LazyStringArrayList.emptyList(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsResponse_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse + getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse build() { + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse buildPartial() { + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse result = + new com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse result) { + if (instancePartitionsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + instancePartitions_ = java.util.Collections.unmodifiableList(instancePartitions_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.instancePartitions_ = instancePartitions_; + } else { + result.instancePartitions_ = instancePartitionsBuilder_.build(); + } + } + + private void buildPartial0( + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + unreachable_.makeImmutable(); + result.unreachable_ = unreachable_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse) { + return mergeFrom( + (com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse other) { + if (other + == com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse + .getDefaultInstance()) return this; + if (instancePartitionsBuilder_ == null) { + if (!other.instancePartitions_.isEmpty()) { + if (instancePartitions_.isEmpty()) { + instancePartitions_ = other.instancePartitions_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureInstancePartitionsIsMutable(); + instancePartitions_.addAll(other.instancePartitions_); + } + onChanged(); + } + } else { + if (!other.instancePartitions_.isEmpty()) { + if (instancePartitionsBuilder_.isEmpty()) { + instancePartitionsBuilder_.dispose(); + instancePartitionsBuilder_ = null; + instancePartitions_ = other.instancePartitions_; + bitField0_ = (bitField0_ & ~0x00000001); + instancePartitionsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getInstancePartitionsFieldBuilder() + : null; + } else { + instancePartitionsBuilder_.addAllMessages(other.instancePartitions_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.unreachable_.isEmpty()) { + if (unreachable_.isEmpty()) { + unreachable_ = other.unreachable_; + bitField0_ |= 0x00000004; + } else { + ensureUnreachableIsMutable(); + unreachable_.addAll(other.unreachable_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.spanner.admin.instance.v1.InstancePartition m = + input.readMessage( + com.google.spanner.admin.instance.v1.InstancePartition.parser(), + extensionRegistry); + if (instancePartitionsBuilder_ == null) { + ensureInstancePartitionsIsMutable(); + instancePartitions_.add(m); + } else { + instancePartitionsBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureUnreachableIsMutable(); + unreachable_.add(s); + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List + instancePartitions_ = java.util.Collections.emptyList(); + + private void ensureInstancePartitionsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + instancePartitions_ = + new java.util.ArrayList( + instancePartitions_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder> + instancePartitionsBuilder_; + + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public java.util.List + getInstancePartitionsList() { + if (instancePartitionsBuilder_ == null) { + return java.util.Collections.unmodifiableList(instancePartitions_); + } else { + return instancePartitionsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public int getInstancePartitionsCount() { + if (instancePartitionsBuilder_ == null) { + return instancePartitions_.size(); + } else { + return instancePartitionsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public com.google.spanner.admin.instance.v1.InstancePartition getInstancePartitions(int index) { + if (instancePartitionsBuilder_ == null) { + return instancePartitions_.get(index); + } else { + return instancePartitionsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public Builder setInstancePartitions( + int index, com.google.spanner.admin.instance.v1.InstancePartition value) { + if (instancePartitionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInstancePartitionsIsMutable(); + instancePartitions_.set(index, value); + onChanged(); + } else { + instancePartitionsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public Builder setInstancePartitions( + int index, com.google.spanner.admin.instance.v1.InstancePartition.Builder builderForValue) { + if (instancePartitionsBuilder_ == null) { + ensureInstancePartitionsIsMutable(); + instancePartitions_.set(index, builderForValue.build()); + onChanged(); + } else { + instancePartitionsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public Builder addInstancePartitions( + com.google.spanner.admin.instance.v1.InstancePartition value) { + if (instancePartitionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInstancePartitionsIsMutable(); + instancePartitions_.add(value); + onChanged(); + } else { + instancePartitionsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public Builder addInstancePartitions( + int index, com.google.spanner.admin.instance.v1.InstancePartition value) { + if (instancePartitionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInstancePartitionsIsMutable(); + instancePartitions_.add(index, value); + onChanged(); + } else { + instancePartitionsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public Builder addInstancePartitions( + com.google.spanner.admin.instance.v1.InstancePartition.Builder builderForValue) { + if (instancePartitionsBuilder_ == null) { + ensureInstancePartitionsIsMutable(); + instancePartitions_.add(builderForValue.build()); + onChanged(); + } else { + instancePartitionsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public Builder addInstancePartitions( + int index, com.google.spanner.admin.instance.v1.InstancePartition.Builder builderForValue) { + if (instancePartitionsBuilder_ == null) { + ensureInstancePartitionsIsMutable(); + instancePartitions_.add(index, builderForValue.build()); + onChanged(); + } else { + instancePartitionsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public Builder addAllInstancePartitions( + java.lang.Iterable + values) { + if (instancePartitionsBuilder_ == null) { + ensureInstancePartitionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, instancePartitions_); + onChanged(); + } else { + instancePartitionsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public Builder clearInstancePartitions() { + if (instancePartitionsBuilder_ == null) { + instancePartitions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + instancePartitionsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public Builder removeInstancePartitions(int index) { + if (instancePartitionsBuilder_ == null) { + ensureInstancePartitionsIsMutable(); + instancePartitions_.remove(index); + onChanged(); + } else { + instancePartitionsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public com.google.spanner.admin.instance.v1.InstancePartition.Builder + getInstancePartitionsBuilder(int index) { + return getInstancePartitionsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder + getInstancePartitionsOrBuilder(int index) { + if (instancePartitionsBuilder_ == null) { + return instancePartitions_.get(index); + } else { + return instancePartitionsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public java.util.List + getInstancePartitionsOrBuilderList() { + if (instancePartitionsBuilder_ != null) { + return instancePartitionsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(instancePartitions_); + } + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public com.google.spanner.admin.instance.v1.InstancePartition.Builder + addInstancePartitionsBuilder() { + return getInstancePartitionsFieldBuilder() + .addBuilder(com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance()); + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public com.google.spanner.admin.instance.v1.InstancePartition.Builder + addInstancePartitionsBuilder(int index) { + return getInstancePartitionsFieldBuilder() + .addBuilder( + index, com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance()); + } + /** + * + * + *
+     * The list of requested instancePartitions.
+     * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + public java.util.List + getInstancePartitionsBuilderList() { + return getInstancePartitionsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder> + getInstancePartitionsFieldBuilder() { + if (instancePartitionsBuilder_ == null) { + instancePartitionsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder>( + instancePartitions_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + instancePartitions_ = null; + } + return instancePartitionsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * `next_page_token` can be sent in a subsequent
+     * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]
+     * call to fetch more of the matching instance partitions.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * `next_page_token` can be sent in a subsequent
+     * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]
+     * call to fetch more of the matching instance partitions.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * `next_page_token` can be sent in a subsequent
+     * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]
+     * call to fetch more of the matching instance partitions.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * `next_page_token` can be sent in a subsequent
+     * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]
+     * call to fetch more of the matching instance partitions.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * `next_page_token` can be sent in a subsequent
+     * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]
+     * call to fetch more of the matching instance partitions.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList unreachable_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureUnreachableIsMutable() { + if (!unreachable_.isModifiable()) { + unreachable_ = new com.google.protobuf.LazyStringArrayList(unreachable_); + } + bitField0_ |= 0x00000004; + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @return A list containing the unreachable. + */ + public com.google.protobuf.ProtocolStringList getUnreachableList() { + unreachable_.makeImmutable(); + return unreachable_; + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @return The count of unreachable. + */ + public int getUnreachableCount() { + return unreachable_.size(); + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the element to return. + * @return The unreachable at the given index. + */ + public java.lang.String getUnreachable(int index) { + return unreachable_.get(index); + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachable at the given index. + */ + public com.google.protobuf.ByteString getUnreachableBytes(int index) { + return unreachable_.getByteString(index); + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @param index The index to set the value at. + * @param value The unreachable to set. + * @return This builder for chaining. + */ + public Builder setUnreachable(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureUnreachableIsMutable(); + unreachable_.set(index, value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @param value The unreachable to add. + * @return This builder for chaining. + */ + public Builder addUnreachable(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureUnreachableIsMutable(); + unreachable_.add(value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @param values The unreachable to add. + * @return This builder for chaining. + */ + public Builder addAllUnreachable(java.lang.Iterable values) { + ensureUnreachableIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, unreachable_); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @return This builder for chaining. + */ + public Builder clearUnreachable() { + unreachable_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + ; + onChanged(); + return this; + } + /** + * + * + *
+     * The list of unreachable instance partitions.
+     * It includes the names of instance partitions whose metadata could
+     * not be retrieved within
+     * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @param value The bytes of the unreachable to add. + * @return This builder for chaining. + */ + public Builder addUnreachableBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureUnreachableIsMutable(); + unreachable_.add(value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.ListInstancePartitionsResponse) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.ListInstancePartitionsResponse) + private static final com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse(); + } + + public static com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListInstancePartitionsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ListInstancePartitionsResponse + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsResponseOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsResponseOrBuilder.java new file mode 100644 index 00000000000..c5b595b14df --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancePartitionsResponseOrBuilder.java @@ -0,0 +1,177 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +public interface ListInstancePartitionsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.ListInstancePartitionsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The list of requested instancePartitions.
+   * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + java.util.List + getInstancePartitionsList(); + /** + * + * + *
+   * The list of requested instancePartitions.
+   * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + com.google.spanner.admin.instance.v1.InstancePartition getInstancePartitions(int index); + /** + * + * + *
+   * The list of requested instancePartitions.
+   * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + int getInstancePartitionsCount(); + /** + * + * + *
+   * The list of requested instancePartitions.
+   * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + java.util.List + getInstancePartitionsOrBuilderList(); + /** + * + * + *
+   * The list of requested instancePartitions.
+   * 
+ * + * repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * + */ + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder getInstancePartitionsOrBuilder( + int index); + + /** + * + * + *
+   * `next_page_token` can be sent in a subsequent
+   * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]
+   * call to fetch more of the matching instance partitions.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * `next_page_token` can be sent in a subsequent
+   * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]
+   * call to fetch more of the matching instance partitions.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); + + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @return A list containing the unreachable. + */ + java.util.List getUnreachableList(); + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @return The count of unreachable. + */ + int getUnreachableCount(); + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the element to return. + * @return The unreachable at the given index. + */ + java.lang.String getUnreachable(int index); + /** + * + * + *
+   * The list of unreachable instance partitions.
+   * It includes the names of instance partitions whose metadata could
+   * not be retrieved within
+   * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachable at the given index. + */ + com.google.protobuf.ByteString getUnreachableBytes(int index); +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesRequest.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesRequest.java index 7eab505208a..0a4bc5959f5 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesRequest.java +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesRequest.java @@ -66,6 +66,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.spanner.admin.instance.v1.ListInstancesRequest.Builder.class); } + private int bitField0_; public static final int PARENT_FIELD_NUMBER = 1; @SuppressWarnings("serial") @@ -286,6 +287,71 @@ public com.google.protobuf.ByteString getFilterBytes() { } } + public static final int INSTANCE_DEADLINE_FIELD_NUMBER = 5; + private com.google.protobuf.Timestamp instanceDeadline_; + /** + * + * + *
+   * Deadline used while retrieving metadata for instances.
+   * Instances whose metadata cannot be retrieved within this deadline will be
+   * added to
+   * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+   * in
+   * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+   * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + * + * @return Whether the instanceDeadline field is set. + */ + @java.lang.Override + public boolean hasInstanceDeadline() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Deadline used while retrieving metadata for instances.
+   * Instances whose metadata cannot be retrieved within this deadline will be
+   * added to
+   * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+   * in
+   * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+   * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + * + * @return The instanceDeadline. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getInstanceDeadline() { + return instanceDeadline_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : instanceDeadline_; + } + /** + * + * + *
+   * Deadline used while retrieving metadata for instances.
+   * Instances whose metadata cannot be retrieved within this deadline will be
+   * added to
+   * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+   * in
+   * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+   * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getInstanceDeadlineOrBuilder() { + return instanceDeadline_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : instanceDeadline_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -312,6 +378,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 4, filter_); } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(5, getInstanceDeadline()); + } getUnknownFields().writeTo(output); } @@ -333,6 +402,9 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, filter_); } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getInstanceDeadline()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -353,6 +425,10 @@ public boolean equals(final java.lang.Object obj) { if (getPageSize() != other.getPageSize()) return false; if (!getPageToken().equals(other.getPageToken())) return false; if (!getFilter().equals(other.getFilter())) return false; + if (hasInstanceDeadline() != other.hasInstanceDeadline()) return false; + if (hasInstanceDeadline()) { + if (!getInstanceDeadline().equals(other.getInstanceDeadline())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -372,6 +448,10 @@ public int hashCode() { hash = (53 * hash) + getPageToken().hashCode(); hash = (37 * hash) + FILTER_FIELD_NUMBER; hash = (53 * hash) + getFilter().hashCode(); + if (hasInstanceDeadline()) { + hash = (37 * hash) + INSTANCE_DEADLINE_FIELD_NUMBER; + hash = (53 * hash) + getInstanceDeadline().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -503,10 +583,19 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.spanner.admin.instance.v1.ListInstancesRequest.newBuilder() - private Builder() {} + private Builder() { + maybeForceBuilderInitialization(); + } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getInstanceDeadlineFieldBuilder(); + } } @java.lang.Override @@ -517,6 +606,11 @@ public Builder clear() { pageSize_ = 0; pageToken_ = ""; filter_ = ""; + instanceDeadline_ = null; + if (instanceDeadlineBuilder_ != null) { + instanceDeadlineBuilder_.dispose(); + instanceDeadlineBuilder_ = null; + } return this; } @@ -565,6 +659,13 @@ private void buildPartial0(com.google.spanner.admin.instance.v1.ListInstancesReq if (((from_bitField0_ & 0x00000008) != 0)) { result.filter_ = filter_; } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000010) != 0)) { + result.instanceDeadline_ = + instanceDeadlineBuilder_ == null ? instanceDeadline_ : instanceDeadlineBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -631,6 +732,9 @@ public Builder mergeFrom(com.google.spanner.admin.instance.v1.ListInstancesReque bitField0_ |= 0x00000008; onChanged(); } + if (other.hasInstanceDeadline()) { + mergeInstanceDeadline(other.getInstanceDeadline()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -681,6 +785,13 @@ public Builder mergeFrom( bitField0_ |= 0x00000008; break; } // case 34 + case 42: + { + input.readMessage( + getInstanceDeadlineFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000010; + break; + } // case 42 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1194,6 +1305,236 @@ public Builder setFilterBytes(com.google.protobuf.ByteString value) { return this; } + private com.google.protobuf.Timestamp instanceDeadline_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + instanceDeadlineBuilder_; + /** + * + * + *
+     * Deadline used while retrieving metadata for instances.
+     * Instances whose metadata cannot be retrieved within this deadline will be
+     * added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+     * in
+     * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+     * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + * + * @return Whether the instanceDeadline field is set. + */ + public boolean hasInstanceDeadline() { + return ((bitField0_ & 0x00000010) != 0); + } + /** + * + * + *
+     * Deadline used while retrieving metadata for instances.
+     * Instances whose metadata cannot be retrieved within this deadline will be
+     * added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+     * in
+     * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+     * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + * + * @return The instanceDeadline. + */ + public com.google.protobuf.Timestamp getInstanceDeadline() { + if (instanceDeadlineBuilder_ == null) { + return instanceDeadline_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : instanceDeadline_; + } else { + return instanceDeadlineBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Deadline used while retrieving metadata for instances.
+     * Instances whose metadata cannot be retrieved within this deadline will be
+     * added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+     * in
+     * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+     * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + */ + public Builder setInstanceDeadline(com.google.protobuf.Timestamp value) { + if (instanceDeadlineBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + instanceDeadline_ = value; + } else { + instanceDeadlineBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+     * Deadline used while retrieving metadata for instances.
+     * Instances whose metadata cannot be retrieved within this deadline will be
+     * added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+     * in
+     * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+     * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + */ + public Builder setInstanceDeadline(com.google.protobuf.Timestamp.Builder builderForValue) { + if (instanceDeadlineBuilder_ == null) { + instanceDeadline_ = builderForValue.build(); + } else { + instanceDeadlineBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+     * Deadline used while retrieving metadata for instances.
+     * Instances whose metadata cannot be retrieved within this deadline will be
+     * added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+     * in
+     * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+     * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + */ + public Builder mergeInstanceDeadline(com.google.protobuf.Timestamp value) { + if (instanceDeadlineBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0) + && instanceDeadline_ != null + && instanceDeadline_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getInstanceDeadlineBuilder().mergeFrom(value); + } else { + instanceDeadline_ = value; + } + } else { + instanceDeadlineBuilder_.mergeFrom(value); + } + if (instanceDeadline_ != null) { + bitField0_ |= 0x00000010; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Deadline used while retrieving metadata for instances.
+     * Instances whose metadata cannot be retrieved within this deadline will be
+     * added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+     * in
+     * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+     * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + */ + public Builder clearInstanceDeadline() { + bitField0_ = (bitField0_ & ~0x00000010); + instanceDeadline_ = null; + if (instanceDeadlineBuilder_ != null) { + instanceDeadlineBuilder_.dispose(); + instanceDeadlineBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Deadline used while retrieving metadata for instances.
+     * Instances whose metadata cannot be retrieved within this deadline will be
+     * added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+     * in
+     * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+     * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + */ + public com.google.protobuf.Timestamp.Builder getInstanceDeadlineBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return getInstanceDeadlineFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Deadline used while retrieving metadata for instances.
+     * Instances whose metadata cannot be retrieved within this deadline will be
+     * added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+     * in
+     * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+     * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + */ + public com.google.protobuf.TimestampOrBuilder getInstanceDeadlineOrBuilder() { + if (instanceDeadlineBuilder_ != null) { + return instanceDeadlineBuilder_.getMessageOrBuilder(); + } else { + return instanceDeadline_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : instanceDeadline_; + } + } + /** + * + * + *
+     * Deadline used while retrieving metadata for instances.
+     * Instances whose metadata cannot be retrieved within this deadline will be
+     * added to
+     * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+     * in
+     * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+     * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getInstanceDeadlineFieldBuilder() { + if (instanceDeadlineBuilder_ == null) { + instanceDeadlineBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getInstanceDeadline(), getParentForChildren(), isClean()); + instanceDeadline_ = null; + } + return instanceDeadlineBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesRequestOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesRequestOrBuilder.java index d419a1b4772..db6046fab89 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesRequestOrBuilder.java +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesRequestOrBuilder.java @@ -160,4 +160,54 @@ public interface ListInstancesRequestOrBuilder * @return The bytes for filter. */ com.google.protobuf.ByteString getFilterBytes(); + + /** + * + * + *
+   * Deadline used while retrieving metadata for instances.
+   * Instances whose metadata cannot be retrieved within this deadline will be
+   * added to
+   * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+   * in
+   * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+   * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + * + * @return Whether the instanceDeadline field is set. + */ + boolean hasInstanceDeadline(); + /** + * + * + *
+   * Deadline used while retrieving metadata for instances.
+   * Instances whose metadata cannot be retrieved within this deadline will be
+   * added to
+   * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+   * in
+   * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+   * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + * + * @return The instanceDeadline. + */ + com.google.protobuf.Timestamp getInstanceDeadline(); + /** + * + * + *
+   * Deadline used while retrieving metadata for instances.
+   * Instances whose metadata cannot be retrieved within this deadline will be
+   * added to
+   * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
+   * in
+   * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
+   * 
+ * + * .google.protobuf.Timestamp instance_deadline = 5; + */ + com.google.protobuf.TimestampOrBuilder getInstanceDeadlineOrBuilder(); } diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesResponse.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesResponse.java index 5e34fe8c598..806f77bfe9f 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesResponse.java +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesResponse.java @@ -42,6 +42,7 @@ private ListInstancesResponse(com.google.protobuf.GeneratedMessageV3.Builder private ListInstancesResponse() { instances_ = java.util.Collections.emptyList(); nextPageToken_ = ""; + unreachable_ = com.google.protobuf.LazyStringArrayList.emptyList(); } @java.lang.Override @@ -191,6 +192,82 @@ public com.google.protobuf.ByteString getNextPageTokenBytes() { } } + public static final int UNREACHABLE_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList unreachable_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + * + * + *
+   * The list of unreachable instances.
+   * It includes the names of instances whose metadata could not be retrieved
+   * within
+   * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @return A list containing the unreachable. + */ + public com.google.protobuf.ProtocolStringList getUnreachableList() { + return unreachable_; + } + /** + * + * + *
+   * The list of unreachable instances.
+   * It includes the names of instances whose metadata could not be retrieved
+   * within
+   * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @return The count of unreachable. + */ + public int getUnreachableCount() { + return unreachable_.size(); + } + /** + * + * + *
+   * The list of unreachable instances.
+   * It includes the names of instances whose metadata could not be retrieved
+   * within
+   * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the element to return. + * @return The unreachable at the given index. + */ + public java.lang.String getUnreachable(int index) { + return unreachable_.get(index); + } + /** + * + * + *
+   * The list of unreachable instances.
+   * It includes the names of instances whose metadata could not be retrieved
+   * within
+   * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachable at the given index. + */ + public com.google.protobuf.ByteString getUnreachableBytes(int index) { + return unreachable_.getByteString(index); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -211,6 +288,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); } + for (int i = 0; i < unreachable_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, unreachable_.getRaw(i)); + } getUnknownFields().writeTo(output); } @@ -226,6 +306,14 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); } + { + int dataSize = 0; + for (int i = 0; i < unreachable_.size(); i++) { + dataSize += computeStringSizeNoTag(unreachable_.getRaw(i)); + } + size += dataSize; + size += 1 * getUnreachableList().size(); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -244,6 +332,7 @@ public boolean equals(final java.lang.Object obj) { if (!getInstancesList().equals(other.getInstancesList())) return false; if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!getUnreachableList().equals(other.getUnreachableList())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -261,6 +350,10 @@ public int hashCode() { } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); + if (getUnreachableCount() > 0) { + hash = (37 * hash) + UNREACHABLE_FIELD_NUMBER; + hash = (53 * hash) + getUnreachableList().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -410,6 +503,7 @@ public Builder clear() { } bitField0_ = (bitField0_ & ~0x00000001); nextPageToken_ = ""; + unreachable_ = com.google.protobuf.LazyStringArrayList.emptyList(); return this; } @@ -463,6 +557,10 @@ private void buildPartial0(com.google.spanner.admin.instance.v1.ListInstancesRes if (((from_bitField0_ & 0x00000002) != 0)) { result.nextPageToken_ = nextPageToken_; } + if (((from_bitField0_ & 0x00000004) != 0)) { + unreachable_.makeImmutable(); + result.unreachable_ = unreachable_; + } } @java.lang.Override @@ -543,6 +641,16 @@ public Builder mergeFrom(com.google.spanner.admin.instance.v1.ListInstancesRespo bitField0_ |= 0x00000002; onChanged(); } + if (!other.unreachable_.isEmpty()) { + if (unreachable_.isEmpty()) { + unreachable_ = other.unreachable_; + bitField0_ |= 0x00000004; + } else { + ensureUnreachableIsMutable(); + unreachable_.addAll(other.unreachable_); + } + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -588,6 +696,13 @@ public Builder mergeFrom( bitField0_ |= 0x00000002; break; } // case 18 + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureUnreachableIsMutable(); + unreachable_.add(s); + break; + } // case 26 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1074,6 +1189,207 @@ public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { return this; } + private com.google.protobuf.LazyStringArrayList unreachable_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureUnreachableIsMutable() { + if (!unreachable_.isModifiable()) { + unreachable_ = new com.google.protobuf.LazyStringArrayList(unreachable_); + } + bitField0_ |= 0x00000004; + } + /** + * + * + *
+     * The list of unreachable instances.
+     * It includes the names of instances whose metadata could not be retrieved
+     * within
+     * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @return A list containing the unreachable. + */ + public com.google.protobuf.ProtocolStringList getUnreachableList() { + unreachable_.makeImmutable(); + return unreachable_; + } + /** + * + * + *
+     * The list of unreachable instances.
+     * It includes the names of instances whose metadata could not be retrieved
+     * within
+     * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @return The count of unreachable. + */ + public int getUnreachableCount() { + return unreachable_.size(); + } + /** + * + * + *
+     * The list of unreachable instances.
+     * It includes the names of instances whose metadata could not be retrieved
+     * within
+     * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the element to return. + * @return The unreachable at the given index. + */ + public java.lang.String getUnreachable(int index) { + return unreachable_.get(index); + } + /** + * + * + *
+     * The list of unreachable instances.
+     * It includes the names of instances whose metadata could not be retrieved
+     * within
+     * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachable at the given index. + */ + public com.google.protobuf.ByteString getUnreachableBytes(int index) { + return unreachable_.getByteString(index); + } + /** + * + * + *
+     * The list of unreachable instances.
+     * It includes the names of instances whose metadata could not be retrieved
+     * within
+     * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @param index The index to set the value at. + * @param value The unreachable to set. + * @return This builder for chaining. + */ + public Builder setUnreachable(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureUnreachableIsMutable(); + unreachable_.set(index, value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The list of unreachable instances.
+     * It includes the names of instances whose metadata could not be retrieved
+     * within
+     * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @param value The unreachable to add. + * @return This builder for chaining. + */ + public Builder addUnreachable(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureUnreachableIsMutable(); + unreachable_.add(value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The list of unreachable instances.
+     * It includes the names of instances whose metadata could not be retrieved
+     * within
+     * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @param values The unreachable to add. + * @return This builder for chaining. + */ + public Builder addAllUnreachable(java.lang.Iterable values) { + ensureUnreachableIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, unreachable_); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The list of unreachable instances.
+     * It includes the names of instances whose metadata could not be retrieved
+     * within
+     * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @return This builder for chaining. + */ + public Builder clearUnreachable() { + unreachable_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + ; + onChanged(); + return this; + } + /** + * + * + *
+     * The list of unreachable instances.
+     * It includes the names of instances whose metadata could not be retrieved
+     * within
+     * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+     * 
+ * + * repeated string unreachable = 3; + * + * @param value The bytes of the unreachable to add. + * @return This builder for chaining. + */ + public Builder addUnreachableBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureUnreachableIsMutable(); + unreachable_.add(value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesResponseOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesResponseOrBuilder.java index c28533c7c01..38b12c3faa4 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesResponseOrBuilder.java +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesResponseOrBuilder.java @@ -104,4 +104,67 @@ public interface ListInstancesResponseOrBuilder * @return The bytes for nextPageToken. */ com.google.protobuf.ByteString getNextPageTokenBytes(); + + /** + * + * + *
+   * The list of unreachable instances.
+   * It includes the names of instances whose metadata could not be retrieved
+   * within
+   * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @return A list containing the unreachable. + */ + java.util.List getUnreachableList(); + /** + * + * + *
+   * The list of unreachable instances.
+   * It includes the names of instances whose metadata could not be retrieved
+   * within
+   * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @return The count of unreachable. + */ + int getUnreachableCount(); + /** + * + * + *
+   * The list of unreachable instances.
+   * It includes the names of instances whose metadata could not be retrieved
+   * within
+   * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the element to return. + * @return The unreachable at the given index. + */ + java.lang.String getUnreachable(int index); + /** + * + * + *
+   * The list of unreachable instances.
+   * It includes the names of instances whose metadata could not be retrieved
+   * within
+   * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachable at the given index. + */ + com.google.protobuf.ByteString getUnreachableBytes(int index); } diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/SpannerInstanceAdminProto.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/SpannerInstanceAdminProto.java index 0a85957e123..01f559e1cb2 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/SpannerInstanceAdminProto.java +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/SpannerInstanceAdminProto.java @@ -132,6 +132,50 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_spanner_admin_instance_v1_UpdateInstanceConfigMetadata_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_spanner_admin_instance_v1_UpdateInstanceConfigMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_InstancePartition_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_InstancePartition_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_DeleteInstancePartitionRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_DeleteInstancePartitionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_GetInstancePartitionRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_GetInstancePartitionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsResponse_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -246,129 +290,235 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\tB3\340A\002\372A-\n+cloudresourcemanager.googleap" + "is.com/Project\022\030\n\013instance_id\030\002 \001(\tB\003\340A\002" + "\022A\n\010instance\030\003 \001(\0132*.google.spanner.admi" - + "n.instance.v1.InstanceB\003\340A\002\"\222\001\n\024ListInst" + + "n.instance.v1.InstanceB\003\340A\002\"\311\001\n\024ListInst" + "ancesRequest\022C\n\006parent\030\001 \001(\tB3\340A\002\372A-\n+cl" + "oudresourcemanager.googleapis.com/Projec" + "t\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t" - + "\022\016\n\006filter\030\004 \001(\t\"o\n\025ListInstancesRespons" - + "e\022=\n\tinstances\030\001 \003(\0132*.google.spanner.ad" - + "min.instance.v1.Instance\022\027\n\017next_page_to" - + "ken\030\002 \001(\t\"\217\001\n\025UpdateInstanceRequest\022A\n\010i" - + "nstance\030\001 \001(\0132*.google.spanner.admin.ins" - + "tance.v1.InstanceB\003\340A\002\0223\n\nfield_mask\030\002 \001" - + "(\0132\032.google.protobuf.FieldMaskB\003\340A\002\"N\n\025D" - + "eleteInstanceRequest\0225\n\004name\030\001 \001(\tB\'\340A\002\372" - + "A!\n\037spanner.googleapis.com/Instance\"\345\001\n\026" - + "CreateInstanceMetadata\022<\n\010instance\030\001 \001(\013" - + "2*.google.spanner.admin.instance.v1.Inst" - + "ance\022.\n\nstart_time\030\002 \001(\0132\032.google.protob" - + "uf.Timestamp\022/\n\013cancel_time\030\003 \001(\0132\032.goog" - + "le.protobuf.Timestamp\022,\n\010end_time\030\004 \001(\0132" - + "\032.google.protobuf.Timestamp\"\345\001\n\026UpdateIn" - + "stanceMetadata\022<\n\010instance\030\001 \001(\0132*.googl" - + "e.spanner.admin.instance.v1.Instance\022.\n\n" - + "start_time\030\002 \001(\0132\032.google.protobuf.Times" - + "tamp\022/\n\013cancel_time\030\003 \001(\0132\032.google.proto" - + "buf.Timestamp\022,\n\010end_time\030\004 \001(\0132\032.google" - + ".protobuf.Timestamp\"\341\001\n\034CreateInstanceCo" - + "nfigMetadata\022I\n\017instance_config\030\001 \001(\01320." + + "\022\016\n\006filter\030\004 \001(\t\0225\n\021instance_deadline\030\005 " + + "\001(\0132\032.google.protobuf.Timestamp\"\204\001\n\025List" + + "InstancesResponse\022=\n\tinstances\030\001 \003(\0132*.g" + + "oogle.spanner.admin.instance.v1.Instance" + + "\022\027\n\017next_page_token\030\002 \001(\t\022\023\n\013unreachable" + + "\030\003 \003(\t\"\217\001\n\025UpdateInstanceRequest\022A\n\010inst" + + "ance\030\001 \001(\0132*.google.spanner.admin.instan" + + "ce.v1.InstanceB\003\340A\002\0223\n\nfield_mask\030\002 \001(\0132" + + "\032.google.protobuf.FieldMaskB\003\340A\002\"N\n\025Dele" + + "teInstanceRequest\0225\n\004name\030\001 \001(\tB\'\340A\002\372A!\n" + + "\037spanner.googleapis.com/Instance\"\345\001\n\026Cre" + + "ateInstanceMetadata\022<\n\010instance\030\001 \001(\0132*." + "google.spanner.admin.instance.v1.Instanc" - + "eConfig\022E\n\010progress\030\002 \001(\01323.google.spann" - + "er.admin.instance.v1.OperationProgress\022/" - + "\n\013cancel_time\030\003 \001(\0132\032.google.protobuf.Ti" - + "mestamp\"\341\001\n\034UpdateInstanceConfigMetadata" - + "\022I\n\017instance_config\030\001 \001(\01320.google.spann" - + "er.admin.instance.v1.InstanceConfig\022E\n\010p" - + "rogress\030\002 \001(\01323.google.spanner.admin.ins" - + "tance.v1.OperationProgress\022/\n\013cancel_tim" - + "e\030\003 \001(\0132\032.google.protobuf.Timestamp2\362\030\n\r" - + "InstanceAdmin\022\314\001\n\023ListInstanceConfigs\022<." - + "google.spanner.admin.instance.v1.ListIns" - + "tanceConfigsRequest\032=.google.spanner.adm" - + "in.instance.v1.ListInstanceConfigsRespon" - + "se\"8\332A\006parent\202\323\344\223\002)\022\'/v1/{parent=project" - + "s/*}/instanceConfigs\022\271\001\n\021GetInstanceConf" - + "ig\022:.google.spanner.admin.instance.v1.Ge" - + "tInstanceConfigRequest\0320.google.spanner." - + "admin.instance.v1.InstanceConfig\"6\332A\004nam" - + "e\202\323\344\223\002)\022\'/v1/{name=projects/*/instanceCo" - + "nfigs/*}\022\310\002\n\024CreateInstanceConfig\022=.goog" - + "le.spanner.admin.instance.v1.CreateInsta" - + "nceConfigRequest\032\035.google.longrunning.Op" - + "eration\"\321\001\312Ap\n/google.spanner.admin.inst" - + "ance.v1.InstanceConfig\022=google.spanner.a" - + "dmin.instance.v1.CreateInstanceConfigMet" - + "adata\332A)parent,instance_config,instance_" - + "config_id\202\323\344\223\002,\"\'/v1/{parent=projects/*}" - + "/instanceConfigs:\001*\022\312\002\n\024UpdateInstanceCo" - + "nfig\022=.google.spanner.admin.instance.v1." - + "UpdateInstanceConfigRequest\032\035.google.lon" - + "grunning.Operation\"\323\001\312Ap\n/google.spanner" - + ".admin.instance.v1.InstanceConfig\022=googl" - + "e.spanner.admin.instance.v1.UpdateInstan" - + "ceConfigMetadata\332A\033instance_config,updat" - + "e_mask\202\323\344\223\002<27/v1/{instance_config.name=" - + "projects/*/instanceConfigs/*}:\001*\022\245\001\n\024Del" - + "eteInstanceConfig\022=.google.spanner.admin" - + ".instance.v1.DeleteInstanceConfigRequest" - + "\032\026.google.protobuf.Empty\"6\332A\004name\202\323\344\223\002)*" - + "\'/v1/{name=projects/*/instanceConfigs/*}" - + "\022\360\001\n\034ListInstanceConfigOperations\022E.goog" - + "le.spanner.admin.instance.v1.ListInstanc" - + "eConfigOperationsRequest\032F.google.spanne" - + "r.admin.instance.v1.ListInstanceConfigOp" - + "erationsResponse\"A\332A\006parent\202\323\344\223\0022\0220/v1/{" - + "parent=projects/*}/instanceConfigOperati" - + "ons\022\264\001\n\rListInstances\0226.google.spanner.a" - + "dmin.instance.v1.ListInstancesRequest\0327." + + "e\022.\n\nstart_time\030\002 \001(\0132\032.google.protobuf." + + "Timestamp\022/\n\013cancel_time\030\003 \001(\0132\032.google." + + "protobuf.Timestamp\022,\n\010end_time\030\004 \001(\0132\032.g" + + "oogle.protobuf.Timestamp\"\345\001\n\026UpdateInsta" + + "nceMetadata\022<\n\010instance\030\001 \001(\0132*.google.s" + + "panner.admin.instance.v1.Instance\022.\n\nsta" + + "rt_time\030\002 \001(\0132\032.google.protobuf.Timestam" + + "p\022/\n\013cancel_time\030\003 \001(\0132\032.google.protobuf" + + ".Timestamp\022,\n\010end_time\030\004 \001(\0132\032.google.pr" + + "otobuf.Timestamp\"\341\001\n\034CreateInstanceConfi" + + "gMetadata\022I\n\017instance_config\030\001 \001(\01320.goo" + + "gle.spanner.admin.instance.v1.InstanceCo" + + "nfig\022E\n\010progress\030\002 \001(\01323.google.spanner." + + "admin.instance.v1.OperationProgress\022/\n\013c" + + "ancel_time\030\003 \001(\0132\032.google.protobuf.Times" + + "tamp\"\341\001\n\034UpdateInstanceConfigMetadata\022I\n" + + "\017instance_config\030\001 \001(\01320.google.spanner." + + "admin.instance.v1.InstanceConfig\022E\n\010prog" + + "ress\030\002 \001(\01323.google.spanner.admin.instan" + + "ce.v1.OperationProgress\022/\n\013cancel_time\030\003" + + " \001(\0132\032.google.protobuf.Timestamp\"\216\005\n\021Ins" + + "tancePartition\022\021\n\004name\030\001 \001(\tB\003\340A\002\022=\n\006con" + + "fig\030\002 \001(\tB-\340A\002\372A\'\n%spanner.googleapis.co" + + "m/InstanceConfig\022\031\n\014display_name\030\003 \001(\tB\003" + + "\340A\002\022\024\n\nnode_count\030\005 \001(\005H\000\022\032\n\020processing_" + + "units\030\006 \001(\005H\000\022M\n\005state\030\007 \001(\01629.google.sp" + + "anner.admin.instance.v1.InstancePartitio" + + "n.StateB\003\340A\003\0224\n\013create_time\030\010 \001(\0132\032.goog" + + "le.protobuf.TimestampB\003\340A\003\0224\n\013update_tim" + + "e\030\t \001(\0132\032.google.protobuf.TimestampB\003\340A\003" + + "\022\"\n\025referencing_databases\030\n \003(\tB\003\340A\003\022 \n\023" + + "referencing_backups\030\013 \003(\tB\003\340A\003\022\014\n\004etag\030\014" + + " \001(\t\"7\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022\014\n\010" + + "CREATING\020\001\022\t\n\005READY\020\002:~\352A{\n(spanner.goog" + + "leapis.com/InstancePartition\022Oprojects/{" + + "project}/instances/{instance}/instancePa" + + "rtitions/{instance_partition}B\022\n\020compute" + + "_capacity\"\201\002\n\037CreateInstancePartitionMet" + + "adata\022O\n\022instance_partition\030\001 \001(\01323.goog" + + "le.spanner.admin.instance.v1.InstancePar" + + "tition\022.\n\nstart_time\030\002 \001(\0132\032.google.prot" + + "obuf.Timestamp\022/\n\013cancel_time\030\003 \001(\0132\032.go" + + "ogle.protobuf.Timestamp\022,\n\010end_time\030\004 \001(" + + "\0132\032.google.protobuf.Timestamp\"\323\001\n\036Create" + + "InstancePartitionRequest\0227\n\006parent\030\001 \001(\t" + + "B\'\340A\002\372A!\n\037spanner.googleapis.com/Instanc" + + "e\022\"\n\025instance_partition_id\030\002 \001(\tB\003\340A\002\022T\n" + + "\022instance_partition\030\003 \001(\01323.google.spann" + + "er.admin.instance.v1.InstancePartitionB\003" + + "\340A\002\"n\n\036DeleteInstancePartitionRequest\022>\n" + + "\004name\030\001 \001(\tB0\340A\002\372A*\n(spanner.googleapis." + + "com/InstancePartition\022\014\n\004etag\030\002 \001(\t\"]\n\033G" + + "etInstancePartitionRequest\022>\n\004name\030\001 \001(\t" + + "B0\340A\002\372A*\n(spanner.googleapis.com/Instanc" + + "ePartition\"\253\001\n\036UpdateInstancePartitionRe" + + "quest\022T\n\022instance_partition\030\001 \001(\01323.goog" + + "le.spanner.admin.instance.v1.InstancePar" + + "titionB\003\340A\002\0223\n\nfield_mask\030\002 \001(\0132\032.google" + + ".protobuf.FieldMaskB\003\340A\002\"\201\002\n\037UpdateInsta" + + "ncePartitionMetadata\022O\n\022instance_partiti" + + "on\030\001 \001(\01323.google.spanner.admin.instance" + + ".v1.InstancePartition\022.\n\nstart_time\030\002 \001(" + + "\0132\032.google.protobuf.Timestamp\022/\n\013cancel_" + + "time\030\003 \001(\0132\032.google.protobuf.Timestamp\022," + + "\n\010end_time\030\004 \001(\0132\032.google.protobuf.Times" + + "tamp\"\305\001\n\035ListInstancePartitionsRequest\0227" + + "\n\006parent\030\001 \001(\tB\'\340A\002\372A!\n\037spanner.googleap" + + "is.com/Instance\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npa" + + "ge_token\030\003 \001(\t\022D\n\033instance_partition_dea" + + "dline\030\004 \001(\0132\032.google.protobuf.TimestampB" + + "\003\340A\001\"\240\001\n\036ListInstancePartitionsResponse\022" + + "P\n\023instance_partitions\030\001 \003(\01323.google.sp" + + "anner.admin.instance.v1.InstancePartitio" + + "n\022\027\n\017next_page_token\030\002 \001(\t\022\023\n\013unreachabl" + + "e\030\003 \003(\t\"\355\001\n&ListInstancePartitionOperati" + + "onsRequest\0227\n\006parent\030\001 \001(\tB\'\340A\002\372A!\n\037span" + + "ner.googleapis.com/Instance\022\023\n\006filter\030\002 " + + "\001(\tB\003\340A\001\022\026\n\tpage_size\030\003 \001(\005B\003\340A\001\022\027\n\npage" + + "_token\030\004 \001(\tB\003\340A\001\022D\n\033instance_partition_" + + "deadline\030\005 \001(\0132\032.google.protobuf.Timesta" + + "mpB\003\340A\001\"\236\001\n\'ListInstancePartitionOperati" + + "onsResponse\0221\n\noperations\030\001 \003(\0132\035.google" + + ".longrunning.Operation\022\027\n\017next_page_toke" + + "n\030\002 \001(\t\022\'\n\037unreachable_instance_partitio" + + "ns\030\003 \003(\t2\316%\n\rInstanceAdmin\022\314\001\n\023ListInsta" + + "nceConfigs\022<.google.spanner.admin.instan" + + "ce.v1.ListInstanceConfigsRequest\032=.googl" + + "e.spanner.admin.instance.v1.ListInstance" + + "ConfigsResponse\"8\332A\006parent\202\323\344\223\002)\022\'/v1/{p" + + "arent=projects/*}/instanceConfigs\022\271\001\n\021Ge" + + "tInstanceConfig\022:.google.spanner.admin.i" + + "nstance.v1.GetInstanceConfigRequest\0320.go" + + "ogle.spanner.admin.instance.v1.InstanceC" + + "onfig\"6\332A\004name\202\323\344\223\002)\022\'/v1/{name=projects" + + "/*/instanceConfigs/*}\022\310\002\n\024CreateInstance" + + "Config\022=.google.spanner.admin.instance.v" + + "1.CreateInstanceConfigRequest\032\035.google.l" + + "ongrunning.Operation\"\321\001\312Ap\n/google.spann" + + "er.admin.instance.v1.InstanceConfig\022=goo" + + "gle.spanner.admin.instance.v1.CreateInst" + + "anceConfigMetadata\332A)parent,instance_con" + + "fig,instance_config_id\202\323\344\223\002,\"\'/v1/{paren" + + "t=projects/*}/instanceConfigs:\001*\022\312\002\n\024Upd" + + "ateInstanceConfig\022=.google.spanner.admin" + + ".instance.v1.UpdateInstanceConfigRequest" + + "\032\035.google.longrunning.Operation\"\323\001\312Ap\n/g" + + "oogle.spanner.admin.instance.v1.Instance" + + "Config\022=google.spanner.admin.instance.v1" + + ".UpdateInstanceConfigMetadata\332A\033instance" + + "_config,update_mask\202\323\344\223\002<27/v1/{instance" + + "_config.name=projects/*/instanceConfigs/" + + "*}:\001*\022\245\001\n\024DeleteInstanceConfig\022=.google." + + "spanner.admin.instance.v1.DeleteInstance" + + "ConfigRequest\032\026.google.protobuf.Empty\"6\332" + + "A\004name\202\323\344\223\002)*\'/v1/{name=projects/*/insta" + + "nceConfigs/*}\022\360\001\n\034ListInstanceConfigOper" + + "ations\022E.google.spanner.admin.instance.v" + + "1.ListInstanceConfigOperationsRequest\032F." + "google.spanner.admin.instance.v1.ListIns" - + "tancesResponse\"2\332A\006parent\202\323\344\223\002#\022!/v1/{pa" - + "rent=projects/*}/instances\022\241\001\n\013GetInstan" - + "ce\0224.google.spanner.admin.instance.v1.Ge" - + "tInstanceRequest\032*.google.spanner.admin." - + "instance.v1.Instance\"0\332A\004name\202\323\344\223\002#\022!/v1" - + "/{name=projects/*/instances/*}\022\234\002\n\016Creat" - + "eInstance\0227.google.spanner.admin.instanc" - + "e.v1.CreateInstanceRequest\032\035.google.long" - + "running.Operation\"\261\001\312Ad\n)google.spanner." - + "admin.instance.v1.Instance\0227google.spann" - + "er.admin.instance.v1.CreateInstanceMetad" - + "ata\332A\033parent,instance_id,instance\202\323\344\223\002&\"" - + "!/v1/{parent=projects/*}/instances:\001*\022\235\002" - + "\n\016UpdateInstance\0227.google.spanner.admin." - + "instance.v1.UpdateInstanceRequest\032\035.goog" - + "le.longrunning.Operation\"\262\001\312Ad\n)google.s" - + "panner.admin.instance.v1.Instance\0227googl" - + "e.spanner.admin.instance.v1.UpdateInstan" - + "ceMetadata\332A\023instance,field_mask\202\323\344\223\002/2*" - + "/v1/{instance.name=projects/*/instances/" - + "*}:\001*\022\223\001\n\016DeleteInstance\0227.google.spanne" - + "r.admin.instance.v1.DeleteInstanceReques" - + "t\032\026.google.protobuf.Empty\"0\332A\004name\202\323\344\223\002#" - + "*!/v1/{name=projects/*/instances/*}\022\232\001\n\014" - + "SetIamPolicy\022\".google.iam.v1.SetIamPolic" - + "yRequest\032\025.google.iam.v1.Policy\"O\332A\017reso" - + "urce,policy\202\323\344\223\0027\"2/v1/{resource=project" - + "s/*/instances/*}:setIamPolicy:\001*\022\223\001\n\014Get" - + "IamPolicy\022\".google.iam.v1.GetIamPolicyRe" - + "quest\032\025.google.iam.v1.Policy\"H\332A\010resourc" - + "e\202\323\344\223\0027\"2/v1/{resource=projects/*/instan" - + "ces/*}:getIamPolicy:\001*\022\305\001\n\022TestIamPermis" - + "sions\022(.google.iam.v1.TestIamPermissions" - + "Request\032).google.iam.v1.TestIamPermissio" - + "nsResponse\"Z\332A\024resource,permissions\202\323\344\223\002" - + "=\"8/v1/{resource=projects/*/instances/*}" - + ":testIamPermissions:\001*\032x\312A\026spanner.googl" - + "eapis.com\322A\\https://www.googleapis.com/a" - + "uth/cloud-platform,https://www.googleapi" - + "s.com/auth/spanner.adminB\213\002\n$com.google." - + "spanner.admin.instance.v1B\031SpannerInstan" - + "ceAdminProtoP\001ZFcloud.google.com/go/span" - + "ner/admin/instance/apiv1/instancepb;inst" - + "ancepb\252\002&Google.Cloud.Spanner.Admin.Inst" - + "ance.V1\312\002&Google\\Cloud\\Spanner\\Admin\\Ins" - + "tance\\V1\352\002+Google::Cloud::Spanner::Admin" - + "::Instance::V1b\006proto3" + + "tanceConfigOperationsResponse\"A\332A\006parent" + + "\202\323\344\223\0022\0220/v1/{parent=projects/*}/instance" + + "ConfigOperations\022\264\001\n\rListInstances\0226.goo" + + "gle.spanner.admin.instance.v1.ListInstan" + + "cesRequest\0327.google.spanner.admin.instan" + + "ce.v1.ListInstancesResponse\"2\332A\006parent\202\323" + + "\344\223\002#\022!/v1/{parent=projects/*}/instances\022" + + "\344\001\n\026ListInstancePartitions\022?.google.span" + + "ner.admin.instance.v1.ListInstancePartit" + + "ionsRequest\032@.google.spanner.admin.insta" + + "nce.v1.ListInstancePartitionsResponse\"G\332" + + "A\006parent\202\323\344\223\0028\0226/v1/{parent=projects/*/i" + + "nstances/*}/instancePartitions\022\241\001\n\013GetIn" + + "stance\0224.google.spanner.admin.instance.v" + + "1.GetInstanceRequest\032*.google.spanner.ad" + + "min.instance.v1.Instance\"0\332A\004name\202\323\344\223\002#\022" + + "!/v1/{name=projects/*/instances/*}\022\234\002\n\016C" + + "reateInstance\0227.google.spanner.admin.ins" + + "tance.v1.CreateInstanceRequest\032\035.google." + + "longrunning.Operation\"\261\001\312Ad\n)google.span" + + "ner.admin.instance.v1.Instance\0227google.s" + + "panner.admin.instance.v1.CreateInstanceM" + + "etadata\332A\033parent,instance_id,instance\202\323\344" + + "\223\002&\"!/v1/{parent=projects/*}/instances:\001" + + "*\022\235\002\n\016UpdateInstance\0227.google.spanner.ad" + + "min.instance.v1.UpdateInstanceRequest\032\035." + + "google.longrunning.Operation\"\262\001\312Ad\n)goog" + + "le.spanner.admin.instance.v1.Instance\0227g" + + "oogle.spanner.admin.instance.v1.UpdateIn" + + "stanceMetadata\332A\023instance,field_mask\202\323\344\223" + + "\002/2*/v1/{instance.name=projects/*/instan" + + "ces/*}:\001*\022\223\001\n\016DeleteInstance\0227.google.sp" + + "anner.admin.instance.v1.DeleteInstanceRe" + + "quest\032\026.google.protobuf.Empty\"0\332A\004name\202\323" + + "\344\223\002#*!/v1/{name=projects/*/instances/*}\022" + + "\232\001\n\014SetIamPolicy\022\".google.iam.v1.SetIamP" + + "olicyRequest\032\025.google.iam.v1.Policy\"O\332A\017" + + "resource,policy\202\323\344\223\0027\"2/v1/{resource=pro" + + "jects/*/instances/*}:setIamPolicy:\001*\022\223\001\n" + + "\014GetIamPolicy\022\".google.iam.v1.GetIamPoli" + + "cyRequest\032\025.google.iam.v1.Policy\"H\332A\010res" + + "ource\202\323\344\223\0027\"2/v1/{resource=projects/*/in" + + "stances/*}:getIamPolicy:\001*\022\305\001\n\022TestIamPe" + + "rmissions\022(.google.iam.v1.TestIamPermiss" + + "ionsRequest\032).google.iam.v1.TestIamPermi" + + "ssionsResponse\"Z\332A\024resource,permissions\202" + + "\323\344\223\002=\"8/v1/{resource=projects/*/instance" + + "s/*}:testIamPermissions:\001*\022\321\001\n\024GetInstan" + + "cePartition\022=.google.spanner.admin.insta" + + "nce.v1.GetInstancePartitionRequest\0323.goo" + + "gle.spanner.admin.instance.v1.InstancePa" + + "rtition\"E\332A\004name\202\323\344\223\0028\0226/v1/{name=projec" + + "ts/*/instances/*/instancePartitions/*}\022\351" + + "\002\n\027CreateInstancePartition\022@.google.span" + + "ner.admin.instance.v1.CreateInstancePart" + + "itionRequest\032\035.google.longrunning.Operat" + + "ion\"\354\001\312Av\n2google.spanner.admin.instance" + + ".v1.InstancePartition\022@google.spanner.ad" + + "min.instance.v1.CreateInstancePartitionM" + + "etadata\332A/parent,instance_partition,inst" + + "ance_partition_id\202\323\344\223\002;\"6/v1/{parent=pro" + + "jects/*/instances/*}/instancePartitions:" + + "\001*\022\272\001\n\027DeleteInstancePartition\022@.google." + + "spanner.admin.instance.v1.DeleteInstance" + + "PartitionRequest\032\026.google.protobuf.Empty" + + "\"E\332A\004name\202\323\344\223\0028*6/v1/{name=projects/*/in" + + "stances/*/instancePartitions/*}\022\352\002\n\027Upda" + + "teInstancePartition\022@.google.spanner.adm" + + "in.instance.v1.UpdateInstancePartitionRe" + + "quest\032\035.google.longrunning.Operation\"\355\001\312" + + "Av\n2google.spanner.admin.instance.v1.Ins" + + "tancePartition\022@google.spanner.admin.ins" + + "tance.v1.UpdateInstancePartitionMetadata" + + "\332A\035instance_partition,field_mask\202\323\344\223\002N2I" + + "/v1/{instance_partition.name=projects/*/" + + "instances/*/instancePartitions/*}:\001*\022\210\002\n" + + "\037ListInstancePartitionOperations\022H.googl" + + "e.spanner.admin.instance.v1.ListInstance" + + "PartitionOperationsRequest\032I.google.span" + + "ner.admin.instance.v1.ListInstancePartit" + + "ionOperationsResponse\"P\332A\006parent\202\323\344\223\002A\022?" + + "/v1/{parent=projects/*/instances/*}/inst" + + "ancePartitionOperations\032x\312A\026spanner.goog" + + "leapis.com\322A\\https://www.googleapis.com/" + + "auth/cloud-platform,https://www.googleap" + + "is.com/auth/spanner.adminB\213\002\n$com.google" + + ".spanner.admin.instance.v1B\031SpannerInsta" + + "nceAdminProtoP\001ZFcloud.google.com/go/spa" + + "nner/admin/instance/apiv1/instancepb;ins" + + "tancepb\252\002&Google.Cloud.Spanner.Admin.Ins" + + "tance.V1\312\002&Google\\Cloud\\Spanner\\Admin\\In" + + "stance\\V1\352\002+Google::Cloud::Spanner::Admi" + + "n::Instance::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -569,7 +719,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_ListInstancesRequest_descriptor, new java.lang.String[] { - "Parent", "PageSize", "PageToken", "Filter", + "Parent", "PageSize", "PageToken", "Filter", "InstanceDeadline", }); internal_static_google_spanner_admin_instance_v1_ListInstancesResponse_descriptor = getDescriptor().getMessageTypes().get(15); @@ -577,7 +727,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_ListInstancesResponse_descriptor, new java.lang.String[] { - "Instances", "NextPageToken", + "Instances", "NextPageToken", "Unreachable", }); internal_static_google_spanner_admin_instance_v1_UpdateInstanceRequest_descriptor = getDescriptor().getMessageTypes().get(16); @@ -627,6 +777,105 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "InstanceConfig", "Progress", "CancelTime", }); + internal_static_google_spanner_admin_instance_v1_InstancePartition_descriptor = + getDescriptor().getMessageTypes().get(22); + internal_static_google_spanner_admin_instance_v1_InstancePartition_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_InstancePartition_descriptor, + new java.lang.String[] { + "Name", + "Config", + "DisplayName", + "NodeCount", + "ProcessingUnits", + "State", + "CreateTime", + "UpdateTime", + "ReferencingDatabases", + "ReferencingBackups", + "Etag", + "ComputeCapacity", + }); + internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionMetadata_descriptor = + getDescriptor().getMessageTypes().get(23); + internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionMetadata_descriptor, + new java.lang.String[] { + "InstancePartition", "StartTime", "CancelTime", "EndTime", + }); + internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionRequest_descriptor = + getDescriptor().getMessageTypes().get(24); + internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionRequest_descriptor, + new java.lang.String[] { + "Parent", "InstancePartitionId", "InstancePartition", + }); + internal_static_google_spanner_admin_instance_v1_DeleteInstancePartitionRequest_descriptor = + getDescriptor().getMessageTypes().get(25); + internal_static_google_spanner_admin_instance_v1_DeleteInstancePartitionRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_DeleteInstancePartitionRequest_descriptor, + new java.lang.String[] { + "Name", "Etag", + }); + internal_static_google_spanner_admin_instance_v1_GetInstancePartitionRequest_descriptor = + getDescriptor().getMessageTypes().get(26); + internal_static_google_spanner_admin_instance_v1_GetInstancePartitionRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_GetInstancePartitionRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionRequest_descriptor = + getDescriptor().getMessageTypes().get(27); + internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionRequest_descriptor, + new java.lang.String[] { + "InstancePartition", "FieldMask", + }); + internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionMetadata_descriptor = + getDescriptor().getMessageTypes().get(28); + internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionMetadata_descriptor, + new java.lang.String[] { + "InstancePartition", "StartTime", "CancelTime", "EndTime", + }); + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsRequest_descriptor = + getDescriptor().getMessageTypes().get(29); + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", "InstancePartitionDeadline", + }); + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsResponse_descriptor = + getDescriptor().getMessageTypes().get(30); + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsResponse_descriptor, + new java.lang.String[] { + "InstancePartitions", "NextPageToken", "Unreachable", + }); + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsRequest_descriptor = + getDescriptor().getMessageTypes().get(31); + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsRequest_descriptor, + new java.lang.String[] { + "Parent", "Filter", "PageSize", "PageToken", "InstancePartitionDeadline", + }); + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsResponse_descriptor = + getDescriptor().getMessageTypes().get(32); + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsResponse_descriptor, + new java.lang.String[] { + "Operations", "NextPageToken", "UnreachableInstancePartitions", + }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); registry.add(com.google.api.ClientProto.defaultHost); diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionMetadata.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionMetadata.java new file mode 100644 index 00000000000..ffd1dc82147 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionMetadata.java @@ -0,0 +1,1579 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +/** + * + * + *
+ * Metadata type for the operation returned by
+ * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition].
+ * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata} + */ +public final class UpdateInstancePartitionMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata) + UpdateInstancePartitionMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateInstancePartitionMetadata.newBuilder() to construct. + private UpdateInstancePartitionMetadata( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateInstancePartitionMetadata() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateInstancePartitionMetadata(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.class, + com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.Builder.class); + } + + private int bitField0_; + public static final int INSTANCE_PARTITION_FIELD_NUMBER = 1; + private com.google.spanner.admin.instance.v1.InstancePartition instancePartition_; + /** + * + * + *
+   * The desired end state of the update.
+   * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * + * @return Whether the instancePartition field is set. + */ + @java.lang.Override + public boolean hasInstancePartition() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * The desired end state of the update.
+   * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * + * @return The instancePartition. + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartition getInstancePartition() { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } + /** + * + * + *
+   * The desired end state of the update.
+   * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder + getInstancePartitionOrBuilder() { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } + + public static final int START_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp startTime_; + /** + * + * + *
+   * The time at which
+   * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+   * request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return Whether the startTime field is set. + */ + @java.lang.Override + public boolean hasStartTime() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * The time at which
+   * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+   * request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return The startTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getStartTime() { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + /** + * + * + *
+   * The time at which
+   * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+   * request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + + public static final int CANCEL_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp cancelTime_; + /** + * + * + *
+   * The time at which this operation was cancelled. If set, this operation is
+   * in the process of undoing itself (which is guaranteed to succeed) and
+   * cannot be cancelled again.
+   * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + * + * @return Whether the cancelTime field is set. + */ + @java.lang.Override + public boolean hasCancelTime() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+   * The time at which this operation was cancelled. If set, this operation is
+   * in the process of undoing itself (which is guaranteed to succeed) and
+   * cannot be cancelled again.
+   * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + * + * @return The cancelTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCancelTime() { + return cancelTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : cancelTime_; + } + /** + * + * + *
+   * The time at which this operation was cancelled. If set, this operation is
+   * in the process of undoing itself (which is guaranteed to succeed) and
+   * cannot be cancelled again.
+   * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCancelTimeOrBuilder() { + return cancelTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : cancelTime_; + } + + public static final int END_TIME_FIELD_NUMBER = 4; + private com.google.protobuf.Timestamp endTime_; + /** + * + * + *
+   * The time at which this operation failed or was completed successfully.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4; + * + * @return Whether the endTime field is set. + */ + @java.lang.Override + public boolean hasEndTime() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+   * The time at which this operation failed or was completed successfully.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4; + * + * @return The endTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getEndTime() { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + /** + * + * + *
+   * The time at which this operation failed or was completed successfully.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getInstancePartition()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(2, getStartTime()); + } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(3, getCancelTime()); + } + if (((bitField0_ & 0x00000008) != 0)) { + output.writeMessage(4, getEndTime()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getInstancePartition()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getStartTime()); + } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getCancelTime()); + } + if (((bitField0_ & 0x00000008) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getEndTime()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata other = + (com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata) obj; + + if (hasInstancePartition() != other.hasInstancePartition()) return false; + if (hasInstancePartition()) { + if (!getInstancePartition().equals(other.getInstancePartition())) return false; + } + if (hasStartTime() != other.hasStartTime()) return false; + if (hasStartTime()) { + if (!getStartTime().equals(other.getStartTime())) return false; + } + if (hasCancelTime() != other.hasCancelTime()) return false; + if (hasCancelTime()) { + if (!getCancelTime().equals(other.getCancelTime())) return false; + } + if (hasEndTime() != other.hasEndTime()) return false; + if (hasEndTime()) { + if (!getEndTime().equals(other.getEndTime())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasInstancePartition()) { + hash = (37 * hash) + INSTANCE_PARTITION_FIELD_NUMBER; + hash = (53 * hash) + getInstancePartition().hashCode(); + } + if (hasStartTime()) { + hash = (37 * hash) + START_TIME_FIELD_NUMBER; + hash = (53 * hash) + getStartTime().hashCode(); + } + if (hasCancelTime()) { + hash = (37 * hash) + CANCEL_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCancelTime().hashCode(); + } + if (hasEndTime()) { + hash = (37 * hash) + END_TIME_FIELD_NUMBER; + hash = (53 * hash) + getEndTime().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Metadata type for the operation returned by
+   * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition].
+   * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata) + com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.class, + com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.Builder.class); + } + + // Construct using + // com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getInstancePartitionFieldBuilder(); + getStartTimeFieldBuilder(); + getCancelTimeFieldBuilder(); + getEndTimeFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + instancePartition_ = null; + if (instancePartitionBuilder_ != null) { + instancePartitionBuilder_.dispose(); + instancePartitionBuilder_ = null; + } + startTime_ = null; + if (startTimeBuilder_ != null) { + startTimeBuilder_.dispose(); + startTimeBuilder_ = null; + } + cancelTime_ = null; + if (cancelTimeBuilder_ != null) { + cancelTimeBuilder_.dispose(); + cancelTimeBuilder_ = null; + } + endTime_ = null; + if (endTimeBuilder_ != null) { + endTimeBuilder_.dispose(); + endTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionMetadata_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata + getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata build() { + com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata buildPartial() { + com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata result = + new com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.instancePartition_ = + instancePartitionBuilder_ == null + ? instancePartition_ + : instancePartitionBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.startTime_ = startTimeBuilder_ == null ? startTime_ : startTimeBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.cancelTime_ = cancelTimeBuilder_ == null ? cancelTime_ : cancelTimeBuilder_.build(); + to_bitField0_ |= 0x00000004; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.endTime_ = endTimeBuilder_ == null ? endTime_ : endTimeBuilder_.build(); + to_bitField0_ |= 0x00000008; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata) { + return mergeFrom( + (com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata other) { + if (other + == com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata + .getDefaultInstance()) return this; + if (other.hasInstancePartition()) { + mergeInstancePartition(other.getInstancePartition()); + } + if (other.hasStartTime()) { + mergeStartTime(other.getStartTime()); + } + if (other.hasCancelTime()) { + mergeCancelTime(other.getCancelTime()); + } + if (other.hasEndTime()) { + mergeEndTime(other.getEndTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + getInstancePartitionFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(getStartTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage(getCancelTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + input.readMessage(getEndTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.spanner.admin.instance.v1.InstancePartition instancePartition_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder> + instancePartitionBuilder_; + /** + * + * + *
+     * The desired end state of the update.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * + * @return Whether the instancePartition field is set. + */ + public boolean hasInstancePartition() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * The desired end state of the update.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * + * @return The instancePartition. + */ + public com.google.spanner.admin.instance.v1.InstancePartition getInstancePartition() { + if (instancePartitionBuilder_ == null) { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } else { + return instancePartitionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The desired end state of the update.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + public Builder setInstancePartition( + com.google.spanner.admin.instance.v1.InstancePartition value) { + if (instancePartitionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + instancePartition_ = value; + } else { + instancePartitionBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The desired end state of the update.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + public Builder setInstancePartition( + com.google.spanner.admin.instance.v1.InstancePartition.Builder builderForValue) { + if (instancePartitionBuilder_ == null) { + instancePartition_ = builderForValue.build(); + } else { + instancePartitionBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The desired end state of the update.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + public Builder mergeInstancePartition( + com.google.spanner.admin.instance.v1.InstancePartition value) { + if (instancePartitionBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && instancePartition_ != null + && instancePartition_ + != com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance()) { + getInstancePartitionBuilder().mergeFrom(value); + } else { + instancePartition_ = value; + } + } else { + instancePartitionBuilder_.mergeFrom(value); + } + if (instancePartition_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The desired end state of the update.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + public Builder clearInstancePartition() { + bitField0_ = (bitField0_ & ~0x00000001); + instancePartition_ = null; + if (instancePartitionBuilder_ != null) { + instancePartitionBuilder_.dispose(); + instancePartitionBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The desired end state of the update.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + public com.google.spanner.admin.instance.v1.InstancePartition.Builder + getInstancePartitionBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getInstancePartitionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The desired end state of the update.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + public com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder + getInstancePartitionOrBuilder() { + if (instancePartitionBuilder_ != null) { + return instancePartitionBuilder_.getMessageOrBuilder(); + } else { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } + } + /** + * + * + *
+     * The desired end state of the update.
+     * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder> + getInstancePartitionFieldBuilder() { + if (instancePartitionBuilder_ == null) { + instancePartitionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder>( + getInstancePartition(), getParentForChildren(), isClean()); + instancePartition_ = null; + } + return instancePartitionBuilder_; + } + + private com.google.protobuf.Timestamp startTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + startTimeBuilder_; + /** + * + * + *
+     * The time at which
+     * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return Whether the startTime field is set. + */ + public boolean hasStartTime() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * The time at which
+     * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return The startTime. + */ + public com.google.protobuf.Timestamp getStartTime() { + if (startTimeBuilder_ == null) { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } else { + return startTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time at which
+     * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public Builder setStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + startTime_ = value; + } else { + startTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which
+     * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public Builder setStartTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (startTimeBuilder_ == null) { + startTime_ = builderForValue.build(); + } else { + startTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which
+     * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public Builder mergeStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && startTime_ != null + && startTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getStartTimeBuilder().mergeFrom(value); + } else { + startTime_ = value; + } + } else { + startTimeBuilder_.mergeFrom(value); + } + if (startTime_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The time at which
+     * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public Builder clearStartTime() { + bitField0_ = (bitField0_ & ~0x00000002); + startTime_ = null; + if (startTimeBuilder_ != null) { + startTimeBuilder_.dispose(); + startTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which
+     * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public com.google.protobuf.Timestamp.Builder getStartTimeBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getStartTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time at which
+     * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + if (startTimeBuilder_ != null) { + return startTimeBuilder_.getMessageOrBuilder(); + } else { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + } + /** + * + * + *
+     * The time at which
+     * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+     * request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getStartTimeFieldBuilder() { + if (startTimeBuilder_ == null) { + startTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getStartTime(), getParentForChildren(), isClean()); + startTime_ = null; + } + return startTimeBuilder_; + } + + private com.google.protobuf.Timestamp cancelTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + cancelTimeBuilder_; + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + * + * @return Whether the cancelTime field is set. + */ + public boolean hasCancelTime() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + * + * @return The cancelTime. + */ + public com.google.protobuf.Timestamp getCancelTime() { + if (cancelTimeBuilder_ == null) { + return cancelTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : cancelTime_; + } else { + return cancelTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + public Builder setCancelTime(com.google.protobuf.Timestamp value) { + if (cancelTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + cancelTime_ = value; + } else { + cancelTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + public Builder setCancelTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (cancelTimeBuilder_ == null) { + cancelTime_ = builderForValue.build(); + } else { + cancelTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + public Builder mergeCancelTime(com.google.protobuf.Timestamp value) { + if (cancelTimeBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && cancelTime_ != null + && cancelTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getCancelTimeBuilder().mergeFrom(value); + } else { + cancelTime_ = value; + } + } else { + cancelTimeBuilder_.mergeFrom(value); + } + if (cancelTime_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + public Builder clearCancelTime() { + bitField0_ = (bitField0_ & ~0x00000004); + cancelTime_ = null; + if (cancelTimeBuilder_ != null) { + cancelTimeBuilder_.dispose(); + cancelTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + public com.google.protobuf.Timestamp.Builder getCancelTimeBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getCancelTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getCancelTimeOrBuilder() { + if (cancelTimeBuilder_ != null) { + return cancelTimeBuilder_.getMessageOrBuilder(); + } else { + return cancelTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : cancelTime_; + } + } + /** + * + * + *
+     * The time at which this operation was cancelled. If set, this operation is
+     * in the process of undoing itself (which is guaranteed to succeed) and
+     * cannot be cancelled again.
+     * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCancelTimeFieldBuilder() { + if (cancelTimeBuilder_ == null) { + cancelTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCancelTime(), getParentForChildren(), isClean()); + cancelTime_ = null; + } + return cancelTimeBuilder_; + } + + private com.google.protobuf.Timestamp endTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + endTimeBuilder_; + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + * + * @return Whether the endTime field is set. + */ + public boolean hasEndTime() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + * + * @return The endTime. + */ + public com.google.protobuf.Timestamp getEndTime() { + if (endTimeBuilder_ == null) { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } else { + return endTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + public Builder setEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + endTime_ = value; + } else { + endTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + public Builder setEndTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (endTimeBuilder_ == null) { + endTime_ = builderForValue.build(); + } else { + endTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + public Builder mergeEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) + && endTime_ != null + && endTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getEndTimeBuilder().mergeFrom(value); + } else { + endTime_ = value; + } + } else { + endTimeBuilder_.mergeFrom(value); + } + if (endTime_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + public Builder clearEndTime() { + bitField0_ = (bitField0_ & ~0x00000008); + endTime_ = null; + if (endTimeBuilder_ != null) { + endTimeBuilder_.dispose(); + endTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + public com.google.protobuf.Timestamp.Builder getEndTimeBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getEndTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + if (endTimeBuilder_ != null) { + return endTimeBuilder_.getMessageOrBuilder(); + } else { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + } + /** + * + * + *
+     * The time at which this operation failed or was completed successfully.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getEndTimeFieldBuilder() { + if (endTimeBuilder_ == null) { + endTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getEndTime(), getParentForChildren(), isClean()); + endTime_ = null; + } + return endTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata) + private static final com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata(); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateInstancePartitionMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionMetadataOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionMetadataOrBuilder.java new file mode 100644 index 00000000000..94ed05800bd --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionMetadataOrBuilder.java @@ -0,0 +1,178 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +public interface UpdateInstancePartitionMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The desired end state of the update.
+   * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * + * @return Whether the instancePartition field is set. + */ + boolean hasInstancePartition(); + /** + * + * + *
+   * The desired end state of the update.
+   * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * + * @return The instancePartition. + */ + com.google.spanner.admin.instance.v1.InstancePartition getInstancePartition(); + /** + * + * + *
+   * The desired end state of the update.
+   * 
+ * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder getInstancePartitionOrBuilder(); + + /** + * + * + *
+   * The time at which
+   * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+   * request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return Whether the startTime field is set. + */ + boolean hasStartTime(); + /** + * + * + *
+   * The time at which
+   * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+   * request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return The startTime. + */ + com.google.protobuf.Timestamp getStartTime(); + /** + * + * + *
+   * The time at which
+   * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
+   * request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder(); + + /** + * + * + *
+   * The time at which this operation was cancelled. If set, this operation is
+   * in the process of undoing itself (which is guaranteed to succeed) and
+   * cannot be cancelled again.
+   * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + * + * @return Whether the cancelTime field is set. + */ + boolean hasCancelTime(); + /** + * + * + *
+   * The time at which this operation was cancelled. If set, this operation is
+   * in the process of undoing itself (which is guaranteed to succeed) and
+   * cannot be cancelled again.
+   * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + * + * @return The cancelTime. + */ + com.google.protobuf.Timestamp getCancelTime(); + /** + * + * + *
+   * The time at which this operation was cancelled. If set, this operation is
+   * in the process of undoing itself (which is guaranteed to succeed) and
+   * cannot be cancelled again.
+   * 
+ * + * .google.protobuf.Timestamp cancel_time = 3; + */ + com.google.protobuf.TimestampOrBuilder getCancelTimeOrBuilder(); + + /** + * + * + *
+   * The time at which this operation failed or was completed successfully.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4; + * + * @return Whether the endTime field is set. + */ + boolean hasEndTime(); + /** + * + * + *
+   * The time at which this operation failed or was completed successfully.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4; + * + * @return The endTime. + */ + com.google.protobuf.Timestamp getEndTime(); + /** + * + * + *
+   * The time at which this operation failed or was completed successfully.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 4; + */ + com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder(); +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionRequest.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionRequest.java new file mode 100644 index 00000000000..8ddc1564de5 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionRequest.java @@ -0,0 +1,1139 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +/** + * + * + *
+ * The request for
+ * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition].
+ * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.UpdateInstancePartitionRequest} + */ +public final class UpdateInstancePartitionRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.UpdateInstancePartitionRequest) + UpdateInstancePartitionRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateInstancePartitionRequest.newBuilder() to construct. + private UpdateInstancePartitionRequest( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateInstancePartitionRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateInstancePartitionRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.class, + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.Builder.class); + } + + private int bitField0_; + public static final int INSTANCE_PARTITION_FIELD_NUMBER = 1; + private com.google.spanner.admin.instance.v1.InstancePartition instancePartition_; + /** + * + * + *
+   * Required. The instance partition to update, which must always include the
+   * instance partition name. Otherwise, only fields mentioned in
+   * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+   * need be included.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the instancePartition field is set. + */ + @java.lang.Override + public boolean hasInstancePartition() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Required. The instance partition to update, which must always include the
+   * instance partition name. Otherwise, only fields mentioned in
+   * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+   * need be included.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The instancePartition. + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartition getInstancePartition() { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } + /** + * + * + *
+   * Required. The instance partition to update, which must always include the
+   * instance partition name. Otherwise, only fields mentioned in
+   * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+   * need be included.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder + getInstancePartitionOrBuilder() { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } + + public static final int FIELD_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask fieldMask_; + /** + * + * + *
+   * Required. A mask specifying which fields in
+   * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+   * should be updated. The field mask must always be specified; this prevents
+   * any future fields in
+   * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+   * from being erased accidentally by clients that do not know about them.
+   * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the fieldMask field is set. + */ + @java.lang.Override + public boolean hasFieldMask() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * Required. A mask specifying which fields in
+   * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+   * should be updated. The field mask must always be specified; this prevents
+   * any future fields in
+   * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+   * from being erased accidentally by clients that do not know about them.
+   * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The fieldMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getFieldMask() { + return fieldMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : fieldMask_; + } + /** + * + * + *
+   * Required. A mask specifying which fields in
+   * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+   * should be updated. The field mask must always be specified; this prevents
+   * any future fields in
+   * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+   * from being erased accidentally by clients that do not know about them.
+   * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getFieldMaskOrBuilder() { + return fieldMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : fieldMask_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getInstancePartition()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(2, getFieldMask()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getInstancePartition()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getFieldMask()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest other = + (com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest) obj; + + if (hasInstancePartition() != other.hasInstancePartition()) return false; + if (hasInstancePartition()) { + if (!getInstancePartition().equals(other.getInstancePartition())) return false; + } + if (hasFieldMask() != other.hasFieldMask()) return false; + if (hasFieldMask()) { + if (!getFieldMask().equals(other.getFieldMask())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasInstancePartition()) { + hash = (37 * hash) + INSTANCE_PARTITION_FIELD_NUMBER; + hash = (53 * hash) + getInstancePartition().hashCode(); + } + if (hasFieldMask()) { + hash = (37 * hash) + FIELD_MASK_FIELD_NUMBER; + hash = (53 * hash) + getFieldMask().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request for
+   * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition].
+   * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.UpdateInstancePartitionRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.UpdateInstancePartitionRequest) + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.class, + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.Builder.class); + } + + // Construct using + // com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getInstancePartitionFieldBuilder(); + getFieldMaskFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + instancePartition_ = null; + if (instancePartitionBuilder_ != null) { + instancePartitionBuilder_.dispose(); + instancePartitionBuilder_ = null; + } + fieldMask_ = null; + if (fieldMaskBuilder_ != null) { + fieldMaskBuilder_.dispose(); + fieldMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionRequest_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest + getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest build() { + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest buildPartial() { + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest result = + new com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.instancePartition_ = + instancePartitionBuilder_ == null + ? instancePartition_ + : instancePartitionBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.fieldMask_ = fieldMaskBuilder_ == null ? fieldMask_ : fieldMaskBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest) { + return mergeFrom( + (com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest other) { + if (other + == com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest + .getDefaultInstance()) return this; + if (other.hasInstancePartition()) { + mergeInstancePartition(other.getInstancePartition()); + } + if (other.hasFieldMask()) { + mergeFieldMask(other.getFieldMask()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + getInstancePartitionFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(getFieldMaskFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.spanner.admin.instance.v1.InstancePartition instancePartition_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder> + instancePartitionBuilder_; + /** + * + * + *
+     * Required. The instance partition to update, which must always include the
+     * instance partition name. Otherwise, only fields mentioned in
+     * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+     * need be included.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the instancePartition field is set. + */ + public boolean hasInstancePartition() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * Required. The instance partition to update, which must always include the
+     * instance partition name. Otherwise, only fields mentioned in
+     * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+     * need be included.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The instancePartition. + */ + public com.google.spanner.admin.instance.v1.InstancePartition getInstancePartition() { + if (instancePartitionBuilder_ == null) { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } else { + return instancePartitionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The instance partition to update, which must always include the
+     * instance partition name. Otherwise, only fields mentioned in
+     * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+     * need be included.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setInstancePartition( + com.google.spanner.admin.instance.v1.InstancePartition value) { + if (instancePartitionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + instancePartition_ = value; + } else { + instancePartitionBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The instance partition to update, which must always include the
+     * instance partition name. Otherwise, only fields mentioned in
+     * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+     * need be included.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setInstancePartition( + com.google.spanner.admin.instance.v1.InstancePartition.Builder builderForValue) { + if (instancePartitionBuilder_ == null) { + instancePartition_ = builderForValue.build(); + } else { + instancePartitionBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The instance partition to update, which must always include the
+     * instance partition name. Otherwise, only fields mentioned in
+     * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+     * need be included.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeInstancePartition( + com.google.spanner.admin.instance.v1.InstancePartition value) { + if (instancePartitionBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && instancePartition_ != null + && instancePartition_ + != com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance()) { + getInstancePartitionBuilder().mergeFrom(value); + } else { + instancePartition_ = value; + } + } else { + instancePartitionBuilder_.mergeFrom(value); + } + if (instancePartition_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Required. The instance partition to update, which must always include the
+     * instance partition name. Otherwise, only fields mentioned in
+     * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+     * need be included.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearInstancePartition() { + bitField0_ = (bitField0_ & ~0x00000001); + instancePartition_ = null; + if (instancePartitionBuilder_ != null) { + instancePartitionBuilder_.dispose(); + instancePartitionBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The instance partition to update, which must always include the
+     * instance partition name. Otherwise, only fields mentioned in
+     * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+     * need be included.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.spanner.admin.instance.v1.InstancePartition.Builder + getInstancePartitionBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getInstancePartitionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The instance partition to update, which must always include the
+     * instance partition name. Otherwise, only fields mentioned in
+     * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+     * need be included.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder + getInstancePartitionOrBuilder() { + if (instancePartitionBuilder_ != null) { + return instancePartitionBuilder_.getMessageOrBuilder(); + } else { + return instancePartition_ == null + ? com.google.spanner.admin.instance.v1.InstancePartition.getDefaultInstance() + : instancePartition_; + } + } + /** + * + * + *
+     * Required. The instance partition to update, which must always include the
+     * instance partition name. Otherwise, only fields mentioned in
+     * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+     * need be included.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder> + getInstancePartitionFieldBuilder() { + if (instancePartitionBuilder_ == null) { + instancePartitionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.InstancePartition, + com.google.spanner.admin.instance.v1.InstancePartition.Builder, + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder>( + getInstancePartition(), getParentForChildren(), isClean()); + instancePartition_ = null; + } + return instancePartitionBuilder_; + } + + private com.google.protobuf.FieldMask fieldMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + fieldMaskBuilder_; + /** + * + * + *
+     * Required. A mask specifying which fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * should be updated. The field mask must always be specified; this prevents
+     * any future fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * from being erased accidentally by clients that do not know about them.
+     * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the fieldMask field is set. + */ + public boolean hasFieldMask() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Required. A mask specifying which fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * should be updated. The field mask must always be specified; this prevents
+     * any future fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * from being erased accidentally by clients that do not know about them.
+     * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The fieldMask. + */ + public com.google.protobuf.FieldMask getFieldMask() { + if (fieldMaskBuilder_ == null) { + return fieldMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : fieldMask_; + } else { + return fieldMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. A mask specifying which fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * should be updated. The field mask must always be specified; this prevents
+     * any future fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * from being erased accidentally by clients that do not know about them.
+     * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setFieldMask(com.google.protobuf.FieldMask value) { + if (fieldMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + fieldMask_ = value; + } else { + fieldMaskBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. A mask specifying which fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * should be updated. The field mask must always be specified; this prevents
+     * any future fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * from being erased accidentally by clients that do not know about them.
+     * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setFieldMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (fieldMaskBuilder_ == null) { + fieldMask_ = builderForValue.build(); + } else { + fieldMaskBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. A mask specifying which fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * should be updated. The field mask must always be specified; this prevents
+     * any future fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * from being erased accidentally by clients that do not know about them.
+     * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeFieldMask(com.google.protobuf.FieldMask value) { + if (fieldMaskBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && fieldMask_ != null + && fieldMask_ != com.google.protobuf.FieldMask.getDefaultInstance()) { + getFieldMaskBuilder().mergeFrom(value); + } else { + fieldMask_ = value; + } + } else { + fieldMaskBuilder_.mergeFrom(value); + } + if (fieldMask_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Required. A mask specifying which fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * should be updated. The field mask must always be specified; this prevents
+     * any future fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * from being erased accidentally by clients that do not know about them.
+     * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearFieldMask() { + bitField0_ = (bitField0_ & ~0x00000002); + fieldMask_ = null; + if (fieldMaskBuilder_ != null) { + fieldMaskBuilder_.dispose(); + fieldMaskBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. A mask specifying which fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * should be updated. The field mask must always be specified; this prevents
+     * any future fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * from being erased accidentally by clients that do not know about them.
+     * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.protobuf.FieldMask.Builder getFieldMaskBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getFieldMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. A mask specifying which fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * should be updated. The field mask must always be specified; this prevents
+     * any future fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * from being erased accidentally by clients that do not know about them.
+     * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.protobuf.FieldMaskOrBuilder getFieldMaskOrBuilder() { + if (fieldMaskBuilder_ != null) { + return fieldMaskBuilder_.getMessageOrBuilder(); + } else { + return fieldMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : fieldMask_; + } + } + /** + * + * + *
+     * Required. A mask specifying which fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * should be updated. The field mask must always be specified; this prevents
+     * any future fields in
+     * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+     * from being erased accidentally by clients that do not know about them.
+     * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getFieldMaskFieldBuilder() { + if (fieldMaskBuilder_ == null) { + fieldMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getFieldMask(), getParentForChildren(), isClean()); + fieldMask_ = null; + } + return fieldMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.UpdateInstancePartitionRequest) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.UpdateInstancePartitionRequest) + private static final com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest(); + } + + public static com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateInstancePartitionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionRequestOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionRequestOrBuilder.java new file mode 100644 index 00000000000..ffeebecf28e --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstancePartitionRequestOrBuilder.java @@ -0,0 +1,129 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.admin.instance.v1; + +public interface UpdateInstancePartitionRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.UpdateInstancePartitionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The instance partition to update, which must always include the
+   * instance partition name. Otherwise, only fields mentioned in
+   * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+   * need be included.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the instancePartition field is set. + */ + boolean hasInstancePartition(); + /** + * + * + *
+   * Required. The instance partition to update, which must always include the
+   * instance partition name. Otherwise, only fields mentioned in
+   * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+   * need be included.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The instancePartition. + */ + com.google.spanner.admin.instance.v1.InstancePartition getInstancePartition(); + /** + * + * + *
+   * Required. The instance partition to update, which must always include the
+   * instance partition name. Otherwise, only fields mentioned in
+   * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
+   * need be included.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.spanner.admin.instance.v1.InstancePartitionOrBuilder getInstancePartitionOrBuilder(); + + /** + * + * + *
+   * Required. A mask specifying which fields in
+   * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+   * should be updated. The field mask must always be specified; this prevents
+   * any future fields in
+   * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+   * from being erased accidentally by clients that do not know about them.
+   * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the fieldMask field is set. + */ + boolean hasFieldMask(); + /** + * + * + *
+   * Required. A mask specifying which fields in
+   * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+   * should be updated. The field mask must always be specified; this prevents
+   * any future fields in
+   * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+   * from being erased accidentally by clients that do not know about them.
+   * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The fieldMask. + */ + com.google.protobuf.FieldMask getFieldMask(); + /** + * + * + *
+   * Required. A mask specifying which fields in
+   * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+   * should be updated. The field mask must always be specified; this prevents
+   * any future fields in
+   * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
+   * from being erased accidentally by clients that do not know about them.
+   * 
+ * + * .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.protobuf.FieldMaskOrBuilder getFieldMaskOrBuilder(); +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/proto/google/spanner/admin/instance/v1/spanner_instance_admin.proto b/proto-google-cloud-spanner-admin-instance-v1/src/main/proto/google/spanner/admin/instance/v1/spanner_instance_admin.proto index 58051df00f1..836b9063fb3 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/proto/google/spanner/admin/instance/v1/spanner_instance_admin.proto +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/proto/google/spanner/admin/instance/v1/spanner_instance_admin.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -235,6 +235,15 @@ service InstanceAdmin { option (google.api.method_signature) = "parent"; } + // Lists all instance partitions for the given instance. + rpc ListInstancePartitions(ListInstancePartitionsRequest) + returns (ListInstancePartitionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/instances/*}/instancePartitions" + }; + option (google.api.method_signature) = "parent"; + } + // Gets information about a particular instance. rpc GetInstance(GetInstanceRequest) returns (Instance) { option (google.api.http) = { @@ -403,6 +412,161 @@ service InstanceAdmin { }; option (google.api.method_signature) = "resource,permissions"; } + + // Gets information about a particular instance partition. + rpc GetInstancePartition(GetInstancePartitionRequest) + returns (InstancePartition) { + option (google.api.http) = { + get: "/v1/{name=projects/*/instances/*/instancePartitions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates an instance partition and begins preparing it to be used. The + // returned [long-running operation][google.longrunning.Operation] + // can be used to track the progress of preparing the new instance partition. + // The instance partition name is assigned by the caller. If the named + // instance partition already exists, `CreateInstancePartition` returns + // `ALREADY_EXISTS`. + // + // Immediately upon completion of this request: + // + // * The instance partition is readable via the API, with all requested + // attributes but no allocated resources. Its state is `CREATING`. + // + // Until completion of the returned operation: + // + // * Cancelling the operation renders the instance partition immediately + // unreadable via the API. + // * The instance partition can be deleted. + // * All other attempts to modify the instance partition are rejected. + // + // Upon completion of the returned operation: + // + // * Billing for all successfully-allocated resources begins (some types + // may have lower than the requested levels). + // * Databases can start using this instance partition. + // * The instance partition's allocated resource levels are readable via the + // API. + // * The instance partition's state becomes `READY`. + // + // The returned [long-running operation][google.longrunning.Operation] will + // have a name of the format + // `/operations/` and can be used to + // track creation of the instance partition. The + // [metadata][google.longrunning.Operation.metadata] field type is + // [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + // The [response][google.longrunning.Operation.response] field type is + // [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + // successful. + rpc CreateInstancePartition(CreateInstancePartitionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/instances/*}/instancePartitions" + body: "*" + }; + option (google.api.method_signature) = + "parent,instance_partition,instance_partition_id"; + option (google.longrunning.operation_info) = { + response_type: "google.spanner.admin.instance.v1.InstancePartition" + metadata_type: "google.spanner.admin.instance.v1.CreateInstancePartitionMetadata" + }; + } + + // Deletes an existing instance partition. Requires that the + // instance partition is not used by any database or backup and is not the + // default instance partition of an instance. + // + // Authorization requires `spanner.instancePartitions.delete` permission on + // the resource + // [name][google.spanner.admin.instance.v1.InstancePartition.name]. + rpc DeleteInstancePartition(DeleteInstancePartitionRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/instances/*/instancePartitions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates an instance partition, and begins allocating or releasing resources + // as requested. The returned [long-running + // operation][google.longrunning.Operation] can be used to track the + // progress of updating the instance partition. If the named instance + // partition does not exist, returns `NOT_FOUND`. + // + // Immediately upon completion of this request: + // + // * For resource types for which a decrease in the instance partition's + // allocation has been requested, billing is based on the newly-requested + // level. + // + // Until completion of the returned operation: + // + // * Cancelling the operation sets its metadata's + // [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], + // and begins restoring resources to their pre-request values. The + // operation is guaranteed to succeed at undoing all resource changes, + // after which point it terminates with a `CANCELLED` status. + // * All other attempts to modify the instance partition are rejected. + // * Reading the instance partition via the API continues to give the + // pre-request resource levels. + // + // Upon completion of the returned operation: + // + // * Billing begins for all successfully-allocated resources (some types + // may have lower than the requested levels). + // * All newly-reserved resources are available for serving the instance + // partition's tables. + // * The instance partition's new resource levels are readable via the API. + // + // The returned [long-running operation][google.longrunning.Operation] will + // have a name of the format + // `/operations/` and can be used to + // track the instance partition modification. The + // [metadata][google.longrunning.Operation.metadata] field type is + // [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. + // The [response][google.longrunning.Operation.response] field type is + // [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + // successful. + // + // Authorization requires `spanner.instancePartitions.update` permission on + // the resource + // [name][google.spanner.admin.instance.v1.InstancePartition.name]. + rpc UpdateInstancePartition(UpdateInstancePartitionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{instance_partition.name=projects/*/instances/*/instancePartitions/*}" + body: "*" + }; + option (google.api.method_signature) = "instance_partition,field_mask"; + option (google.longrunning.operation_info) = { + response_type: "google.spanner.admin.instance.v1.InstancePartition" + metadata_type: "google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata" + }; + } + + // Lists instance partition [long-running + // operations][google.longrunning.Operation] in the given instance. + // An instance partition operation has a name of the form + // `projects//instances//instancePartitions//operations/`. + // The long-running operation + // [metadata][google.longrunning.Operation.metadata] field type + // `metadata.type_url` describes the type of the metadata. Operations returned + // include those that have completed/failed/canceled within the last 7 days, + // and pending operations. Operations returned are ordered by + // `operation.metadata.value.start_time` in descending order starting from the + // most recently started operation. + // + // Authorization requires `spanner.instancePartitionOperations.list` + // permission on the resource + // [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. + rpc ListInstancePartitionOperations(ListInstancePartitionOperationsRequest) + returns (ListInstancePartitionOperationsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/instances/*}/instancePartitionOperations" + }; + option (google.api.method_signature) = "parent"; + } } message ReplicaInfo { @@ -1041,6 +1205,14 @@ message ListInstancesRequest { // it has the label "env" with its value // containing "dev". string filter = 4; + + // Deadline used while retrieving metadata for instances. + // Instances whose metadata cannot be retrieved within this deadline will be + // added to + // [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable] + // in + // [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. + google.protobuf.Timestamp instance_deadline = 5; } // The response for @@ -1053,6 +1225,12 @@ message ListInstancesResponse { // [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances] // call to fetch more of the matching instances. string next_page_token = 2; + + // The list of unreachable instances. + // It includes the names of instances whose metadata could not be retrieved + // within + // [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline]. + repeated string unreachable = 3; } // The request for @@ -1155,3 +1333,381 @@ message UpdateInstanceConfigMetadata { // The time at which this operation was cancelled. google.protobuf.Timestamp cancel_time = 3; } + +// An isolated set of Cloud Spanner resources that databases can define +// placements on. +message InstancePartition { + option (google.api.resource) = { + type: "spanner.googleapis.com/InstancePartition" + pattern: "projects/{project}/instances/{instance}/instancePartitions/{instance_partition}" + }; + + // Indicates the current state of the instance partition. + enum State { + // Not specified. + STATE_UNSPECIFIED = 0; + + // The instance partition is still being created. Resources may not be + // available yet, and operations such as creating placements using this + // instance partition may not work. + CREATING = 1; + + // The instance partition is fully created and ready to do work such as + // creating placements and using in databases. + READY = 2; + } + + // Required. A unique identifier for the instance partition. Values are of the + // form + // `projects//instances//instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`. + // The final segment of the name must be between 2 and 64 characters in + // length. An instance partition's name cannot be changed after the instance + // partition is created. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the instance partition's configuration. Values are of + // the form `projects//instanceConfigs/`. See also + // [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + // [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. + string config = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "spanner.googleapis.com/InstanceConfig" + } + ]; + + // Required. The descriptive name for this instance partition as it appears in + // UIs. Must be unique per project and between 4 and 30 characters in length. + string display_name = 3 [(google.api.field_behavior) = REQUIRED]; + + // Compute capacity defines amount of server and storage resources that are + // available to the databases in an instance partition. At most one of either + // node_count or processing_units should be present in the message. See [the + // documentation](https://cloud.google.com/spanner/docs/compute-capacity) + // for more information about nodes and processing units. + oneof compute_capacity { + // The number of nodes allocated to this instance partition. + // + // Users can set the node_count field to specify the target number of nodes + // allocated to the instance partition. + // + // This may be zero in API responses for instance partitions that are not + // yet in state `READY`. + int32 node_count = 5; + + // The number of processing units allocated to this instance partition. + // + // Users can set the processing_units field to specify the target number of + // processing units allocated to the instance partition. + // + // This may be zero in API responses for instance partitions that are not + // yet in state `READY`. + int32 processing_units = 6; + } + + // Output only. The current instance partition state. + State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which the instance partition was created. + google.protobuf.Timestamp create_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which the instance partition was most recently + // updated. + google.protobuf.Timestamp update_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The names of the databases that reference this + // instance partition. Referencing databases should share the parent instance. + // The existence of any referencing database prevents the instance partition + // from being deleted. + repeated string referencing_databases = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The names of the backups that reference this instance + // partition. Referencing backups should share the parent instance. The + // existence of any referencing backup prevents the instance partition from + // being deleted. + repeated string referencing_backups = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Used for optimistic concurrency control as a way + // to help prevent simultaneous updates of a instance partition from + // overwriting each other. It is strongly suggested that systems make use of + // the etag in the read-modify-write cycle to perform instance partition + // updates in order to avoid race conditions: An etag is returned in the + // response which contains instance partitions, and systems are expected to + // put that etag in the request to update instance partitions to ensure that + // their change will be applied to the same version of the instance partition. + // If no etag is provided in the call to update instance partition, then the + // existing instance partition is overwritten blindly. + string etag = 12; +} + +// Metadata type for the operation returned by +// [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]. +message CreateInstancePartitionMetadata { + // The instance partition being created. + InstancePartition instance_partition = 1; + + // The time at which the + // [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition] + // request was received. + google.protobuf.Timestamp start_time = 2; + + // The time at which this operation was cancelled. If set, this operation is + // in the process of undoing itself (which is guaranteed to succeed) and + // cannot be cancelled again. + google.protobuf.Timestamp cancel_time = 3; + + // The time at which this operation failed or was completed successfully. + google.protobuf.Timestamp end_time = 4; +} + +// The request for +// [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]. +message CreateInstancePartitionRequest { + // Required. The name of the instance in which to create the instance + // partition. Values are of the form + // `projects//instances/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "spanner.googleapis.com/Instance" + } + ]; + + // Required. The ID of the instance partition to create. Valid identifiers are + // of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + // characters in length. + string instance_partition_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The instance partition to create. The instance_partition.name may + // be omitted, but if specified must be + // `/instancePartitions/`. + InstancePartition instance_partition = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// The request for +// [DeleteInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstancePartition]. +message DeleteInstancePartitionRequest { + // Required. The name of the instance partition to be deleted. + // Values are of the form + // `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "spanner.googleapis.com/InstancePartition" + } + ]; + + // Optional. If not empty, the API only deletes the instance partition when + // the etag provided matches the current status of the requested instance + // partition. Otherwise, deletes the instance partition without checking the + // current status of the requested instance partition. + string etag = 2; +} + +// The request for +// [GetInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.GetInstancePartition]. +message GetInstancePartitionRequest { + // Required. The name of the requested instance partition. Values are of + // the form + // `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "spanner.googleapis.com/InstancePartition" + } + ]; +} + +// The request for +// [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]. +message UpdateInstancePartitionRequest { + // Required. The instance partition to update, which must always include the + // instance partition name. Otherwise, only fields mentioned in + // [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] + // need be included. + InstancePartition instance_partition = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. A mask specifying which fields in + // [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + // should be updated. The field mask must always be specified; this prevents + // any future fields in + // [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + // from being erased accidentally by clients that do not know about them. + google.protobuf.FieldMask field_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata type for the operation returned by +// [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]. +message UpdateInstancePartitionMetadata { + // The desired end state of the update. + InstancePartition instance_partition = 1; + + // The time at which + // [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition] + // request was received. + google.protobuf.Timestamp start_time = 2; + + // The time at which this operation was cancelled. If set, this operation is + // in the process of undoing itself (which is guaranteed to succeed) and + // cannot be cancelled again. + google.protobuf.Timestamp cancel_time = 3; + + // The time at which this operation failed or was completed successfully. + google.protobuf.Timestamp end_time = 4; +} + +// The request for +// [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]. +message ListInstancePartitionsRequest { + // Required. The instance whose instance partitions should be listed. Values + // are of the form `projects//instances/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "spanner.googleapis.com/Instance" + } + ]; + + // Number of instance partitions to be returned in the response. If 0 or less, + // defaults to the server's maximum allowed page size. + int32 page_size = 2; + + // If non-empty, `page_token` should contain a + // [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token] + // from a previous + // [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. + string page_token = 3; + + // Optional. Deadline used while retrieving metadata for instance partitions. + // Instance partitions whose metadata cannot be retrieved within this deadline + // will be added to + // [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable] + // in + // [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. + google.protobuf.Timestamp instance_partition_deadline = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// The response for +// [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]. +message ListInstancePartitionsResponse { + // The list of requested instancePartitions. + repeated InstancePartition instance_partitions = 1; + + // `next_page_token` can be sent in a subsequent + // [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions] + // call to fetch more of the matching instance partitions. + string next_page_token = 2; + + // The list of unreachable instance partitions. + // It includes the names of instance partitions whose metadata could + // not be retrieved within + // [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]. + repeated string unreachable = 3; +} + +// The request for +// [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]. +message ListInstancePartitionOperationsRequest { + // Required. The parent instance of the instance partition operations. + // Values are of the form `projects//instances/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "spanner.googleapis.com/Instance" + } + ]; + + // Optional. An expression that filters the list of returned operations. + // + // A filter expression consists of a field name, a + // comparison operator, and a value for filtering. + // The value must be a string, a number, or a boolean. The comparison operator + // must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + // Colon `:` is the contains operator. Filter rules are not case sensitive. + // + // The following fields in the [Operation][google.longrunning.Operation] + // are eligible for filtering: + // + // * `name` - The name of the long-running operation + // * `done` - False if the operation is in progress, else true. + // * `metadata.@type` - the type of metadata. For example, the type string + // for + // [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] + // is + // `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. + // * `metadata.` - any field in metadata.value. + // `metadata.@type` must be specified first, if filtering on metadata + // fields. + // * `error` - Error associated with the long-running operation. + // * `response.@type` - the type of response. + // * `response.` - any field in response.value. + // + // You can combine multiple expressions by enclosing each expression in + // parentheses. By default, expressions are combined with AND logic. However, + // you can specify AND, OR, and NOT logic explicitly. + // + // Here are a few examples: + // + // * `done:true` - The operation is complete. + // * `(metadata.@type=` \ + // `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + // AND` \ + // `(metadata.instance_partition.name:custom-instance-partition) AND` \ + // `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ + // `(error:*)` - Return operations where: + // * The operation's metadata type is + // [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + // * The instance partition name contains "custom-instance-partition". + // * The operation started before 2021-03-28T14:50:00Z. + // * The operation resulted in an error. + string filter = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Number of operations to be returned in the response. If 0 or + // less, defaults to the server's maximum allowed page size. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If non-empty, `page_token` should contain a + // [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token] + // from a previous + // [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse] + // to the same `parent` and with the same `filter`. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Deadline used while retrieving metadata for instance partition + // operations. Instance partitions whose operation metadata cannot be + // retrieved within this deadline will be added to + // [unreachable][ListInstancePartitionOperationsResponse.unreachable] in + // [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. + google.protobuf.Timestamp instance_partition_deadline = 5 + [(google.api.field_behavior) = OPTIONAL]; +} + +// The response for +// [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]. +message ListInstancePartitionOperationsResponse { + // The list of matching instance partition [long-running + // operations][google.longrunning.Operation]. Each operation's name will be + // prefixed by the instance partition's name. The operation's + // [metadata][google.longrunning.Operation.metadata] field type + // `metadata.type_url` describes the type of the metadata. + repeated google.longrunning.Operation operations = 1; + + // `next_page_token` can be sent in a subsequent + // [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations] + // call to fetch more of the matching metadata. + string next_page_token = 2; + + // The list of unreachable instance partitions. + // It includes the names of instance partitions whose operation metadata could + // not be retrieved within + // [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline]. + repeated string unreachable_instance_partitions = 3; +} diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/AdminAction.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/AdminAction.java index 4f3bcefbdb2..7d745e8ea4d 100644 --- a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/AdminAction.java +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/AdminAction.java @@ -98,7 +98,7 @@ public enum ActionCase LIST_CLOUD_BACKUP_OPERATIONS(24), GET_OPERATION(25), CANCEL_OPERATION(26), - RECONFIGURE_CLOUD_DATABASE(28), + CHANGE_QUORUM_CLOUD_DATABASE(28), ACTION_NOT_SET(0); private final int value; @@ -172,7 +172,7 @@ public static ActionCase forNumber(int value) { case 26: return CANCEL_OPERATION; case 28: - return RECONFIGURE_CLOUD_DATABASE; + return CHANGE_QUORUM_CLOUD_DATABASE; case 0: return ACTION_NOT_SET; default: @@ -1638,63 +1638,63 @@ public com.google.spanner.executor.v1.CancelOperationAction getCancelOperation() return com.google.spanner.executor.v1.CancelOperationAction.getDefaultInstance(); } - public static final int RECONFIGURE_CLOUD_DATABASE_FIELD_NUMBER = 28; + public static final int CHANGE_QUORUM_CLOUD_DATABASE_FIELD_NUMBER = 28; /** * * *
-   * Action that reconfigures a Cloud Spanner database.
+   * Action that changes quorum of a Cloud Spanner database.
    * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * * - * @return Whether the reconfigureCloudDatabase field is set. + * @return Whether the changeQuorumCloudDatabase field is set. */ @java.lang.Override - public boolean hasReconfigureCloudDatabase() { + public boolean hasChangeQuorumCloudDatabase() { return actionCase_ == 28; } /** * * *
-   * Action that reconfigures a Cloud Spanner database.
+   * Action that changes quorum of a Cloud Spanner database.
    * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * * - * @return The reconfigureCloudDatabase. + * @return The changeQuorumCloudDatabase. */ @java.lang.Override - public com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction - getReconfigureCloudDatabase() { + public com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction + getChangeQuorumCloudDatabase() { if (actionCase_ == 28) { - return (com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction) action_; + return (com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) action_; } - return com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.getDefaultInstance(); + return com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.getDefaultInstance(); } /** * * *
-   * Action that reconfigures a Cloud Spanner database.
+   * Action that changes quorum of a Cloud Spanner database.
    * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * */ @java.lang.Override - public com.google.spanner.executor.v1.ReconfigureCloudDatabaseActionOrBuilder - getReconfigureCloudDatabaseOrBuilder() { + public com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseActionOrBuilder + getChangeQuorumCloudDatabaseOrBuilder() { if (actionCase_ == 28) { - return (com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction) action_; + return (com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) action_; } - return com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.getDefaultInstance(); + return com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.getDefaultInstance(); } private byte memoizedIsInitialized = -1; @@ -1801,7 +1801,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io } if (actionCase_ == 28) { output.writeMessage( - 28, (com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction) action_); + 28, (com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) action_); } getUnknownFields().writeTo(output); } @@ -1950,7 +1950,7 @@ public int getSerializedSize() { if (actionCase_ == 28) { size += com.google.protobuf.CodedOutputStream.computeMessageSize( - 28, (com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction) action_); + 28, (com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) action_); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; @@ -2057,7 +2057,7 @@ public boolean equals(final java.lang.Object obj) { if (!getCancelOperation().equals(other.getCancelOperation())) return false; break; case 28: - if (!getReconfigureCloudDatabase().equals(other.getReconfigureCloudDatabase())) + if (!getChangeQuorumCloudDatabase().equals(other.getChangeQuorumCloudDatabase())) return false; break; case 0: @@ -2184,8 +2184,8 @@ public int hashCode() { hash = (53 * hash) + getCancelOperation().hashCode(); break; case 28: - hash = (37 * hash) + RECONFIGURE_CLOUD_DATABASE_FIELD_NUMBER; - hash = (53 * hash) + getReconfigureCloudDatabase().hashCode(); + hash = (37 * hash) + CHANGE_QUORUM_CLOUD_DATABASE_FIELD_NUMBER; + hash = (53 * hash) + getChangeQuorumCloudDatabase().hashCode(); break; case 0: default: @@ -2411,8 +2411,8 @@ public Builder clear() { if (cancelOperationBuilder_ != null) { cancelOperationBuilder_.clear(); } - if (reconfigureCloudDatabaseBuilder_ != null) { - reconfigureCloudDatabaseBuilder_.clear(); + if (changeQuorumCloudDatabaseBuilder_ != null) { + changeQuorumCloudDatabaseBuilder_.clear(); } actionCase_ = 0; action_ = null; @@ -2539,8 +2539,8 @@ private void buildPartialOneofs(com.google.spanner.executor.v1.AdminAction resul if (actionCase_ == 26 && cancelOperationBuilder_ != null) { result.action_ = cancelOperationBuilder_.build(); } - if (actionCase_ == 28 && reconfigureCloudDatabaseBuilder_ != null) { - result.action_ = reconfigureCloudDatabaseBuilder_.build(); + if (actionCase_ == 28 && changeQuorumCloudDatabaseBuilder_ != null) { + result.action_ = changeQuorumCloudDatabaseBuilder_.build(); } } @@ -2725,9 +2725,9 @@ public Builder mergeFrom(com.google.spanner.executor.v1.AdminAction other) { mergeCancelOperation(other.getCancelOperation()); break; } - case RECONFIGURE_CLOUD_DATABASE: + case CHANGE_QUORUM_CLOUD_DATABASE: { - mergeReconfigureCloudDatabase(other.getReconfigureCloudDatabase()); + mergeChangeQuorumCloudDatabase(other.getChangeQuorumCloudDatabase()); break; } case ACTION_NOT_SET: @@ -2949,7 +2949,7 @@ public Builder mergeFrom( case 226: { input.readMessage( - getReconfigureCloudDatabaseFieldBuilder().getBuilder(), extensionRegistry); + getChangeQuorumCloudDatabaseFieldBuilder().getBuilder(), extensionRegistry); actionCase_ = 28; break; } // case 226 @@ -8932,76 +8932,76 @@ public Builder clearCancelOperation() { } private com.google.protobuf.SingleFieldBuilderV3< - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction, - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.Builder, - com.google.spanner.executor.v1.ReconfigureCloudDatabaseActionOrBuilder> - reconfigureCloudDatabaseBuilder_; + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction, + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.Builder, + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseActionOrBuilder> + changeQuorumCloudDatabaseBuilder_; /** * * *
-     * Action that reconfigures a Cloud Spanner database.
+     * Action that changes quorum of a Cloud Spanner database.
      * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * * - * @return Whether the reconfigureCloudDatabase field is set. + * @return Whether the changeQuorumCloudDatabase field is set. */ @java.lang.Override - public boolean hasReconfigureCloudDatabase() { + public boolean hasChangeQuorumCloudDatabase() { return actionCase_ == 28; } /** * * *
-     * Action that reconfigures a Cloud Spanner database.
+     * Action that changes quorum of a Cloud Spanner database.
      * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * * - * @return The reconfigureCloudDatabase. + * @return The changeQuorumCloudDatabase. */ @java.lang.Override - public com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction - getReconfigureCloudDatabase() { - if (reconfigureCloudDatabaseBuilder_ == null) { + public com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction + getChangeQuorumCloudDatabase() { + if (changeQuorumCloudDatabaseBuilder_ == null) { if (actionCase_ == 28) { - return (com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction) action_; + return (com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) action_; } - return com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.getDefaultInstance(); + return com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.getDefaultInstance(); } else { if (actionCase_ == 28) { - return reconfigureCloudDatabaseBuilder_.getMessage(); + return changeQuorumCloudDatabaseBuilder_.getMessage(); } - return com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.getDefaultInstance(); + return com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.getDefaultInstance(); } } /** * * *
-     * Action that reconfigures a Cloud Spanner database.
+     * Action that changes quorum of a Cloud Spanner database.
      * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * */ - public Builder setReconfigureCloudDatabase( - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction value) { - if (reconfigureCloudDatabaseBuilder_ == null) { + public Builder setChangeQuorumCloudDatabase( + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction value) { + if (changeQuorumCloudDatabaseBuilder_ == null) { if (value == null) { throw new NullPointerException(); } action_ = value; onChanged(); } else { - reconfigureCloudDatabaseBuilder_.setMessage(value); + changeQuorumCloudDatabaseBuilder_.setMessage(value); } actionCase_ = 28; return this; @@ -9010,20 +9010,20 @@ public Builder setReconfigureCloudDatabase( * * *
-     * Action that reconfigures a Cloud Spanner database.
+     * Action that changes quorum of a Cloud Spanner database.
      * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * */ - public Builder setReconfigureCloudDatabase( - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.Builder builderForValue) { - if (reconfigureCloudDatabaseBuilder_ == null) { + public Builder setChangeQuorumCloudDatabase( + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.Builder builderForValue) { + if (changeQuorumCloudDatabaseBuilder_ == null) { action_ = builderForValue.build(); onChanged(); } else { - reconfigureCloudDatabaseBuilder_.setMessage(builderForValue.build()); + changeQuorumCloudDatabaseBuilder_.setMessage(builderForValue.build()); } actionCase_ = 28; return this; @@ -9032,23 +9032,23 @@ public Builder setReconfigureCloudDatabase( * * *
-     * Action that reconfigures a Cloud Spanner database.
+     * Action that changes quorum of a Cloud Spanner database.
      * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * */ - public Builder mergeReconfigureCloudDatabase( - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction value) { - if (reconfigureCloudDatabaseBuilder_ == null) { + public Builder mergeChangeQuorumCloudDatabase( + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction value) { + if (changeQuorumCloudDatabaseBuilder_ == null) { if (actionCase_ == 28 && action_ - != com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction + != com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction .getDefaultInstance()) { action_ = - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.newBuilder( - (com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction) action_) + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.newBuilder( + (com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) action_) .mergeFrom(value) .buildPartial(); } else { @@ -9057,9 +9057,9 @@ public Builder mergeReconfigureCloudDatabase( onChanged(); } else { if (actionCase_ == 28) { - reconfigureCloudDatabaseBuilder_.mergeFrom(value); + changeQuorumCloudDatabaseBuilder_.mergeFrom(value); } else { - reconfigureCloudDatabaseBuilder_.setMessage(value); + changeQuorumCloudDatabaseBuilder_.setMessage(value); } } actionCase_ = 28; @@ -9069,15 +9069,15 @@ public Builder mergeReconfigureCloudDatabase( * * *
-     * Action that reconfigures a Cloud Spanner database.
+     * Action that changes quorum of a Cloud Spanner database.
      * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * */ - public Builder clearReconfigureCloudDatabase() { - if (reconfigureCloudDatabaseBuilder_ == null) { + public Builder clearChangeQuorumCloudDatabase() { + if (changeQuorumCloudDatabaseBuilder_ == null) { if (actionCase_ == 28) { actionCase_ = 0; action_ = null; @@ -9088,7 +9088,7 @@ public Builder clearReconfigureCloudDatabase() { actionCase_ = 0; action_ = null; } - reconfigureCloudDatabaseBuilder_.clear(); + changeQuorumCloudDatabaseBuilder_.clear(); } return this; } @@ -9096,74 +9096,74 @@ public Builder clearReconfigureCloudDatabase() { * * *
-     * Action that reconfigures a Cloud Spanner database.
+     * Action that changes quorum of a Cloud Spanner database.
      * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * */ - public com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.Builder - getReconfigureCloudDatabaseBuilder() { - return getReconfigureCloudDatabaseFieldBuilder().getBuilder(); + public com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.Builder + getChangeQuorumCloudDatabaseBuilder() { + return getChangeQuorumCloudDatabaseFieldBuilder().getBuilder(); } /** * * *
-     * Action that reconfigures a Cloud Spanner database.
+     * Action that changes quorum of a Cloud Spanner database.
      * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * */ @java.lang.Override - public com.google.spanner.executor.v1.ReconfigureCloudDatabaseActionOrBuilder - getReconfigureCloudDatabaseOrBuilder() { - if ((actionCase_ == 28) && (reconfigureCloudDatabaseBuilder_ != null)) { - return reconfigureCloudDatabaseBuilder_.getMessageOrBuilder(); + public com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseActionOrBuilder + getChangeQuorumCloudDatabaseOrBuilder() { + if ((actionCase_ == 28) && (changeQuorumCloudDatabaseBuilder_ != null)) { + return changeQuorumCloudDatabaseBuilder_.getMessageOrBuilder(); } else { if (actionCase_ == 28) { - return (com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction) action_; + return (com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) action_; } - return com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.getDefaultInstance(); + return com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.getDefaultInstance(); } } /** * * *
-     * Action that reconfigures a Cloud Spanner database.
+     * Action that changes quorum of a Cloud Spanner database.
      * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * */ private com.google.protobuf.SingleFieldBuilderV3< - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction, - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.Builder, - com.google.spanner.executor.v1.ReconfigureCloudDatabaseActionOrBuilder> - getReconfigureCloudDatabaseFieldBuilder() { - if (reconfigureCloudDatabaseBuilder_ == null) { + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction, + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.Builder, + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseActionOrBuilder> + getChangeQuorumCloudDatabaseFieldBuilder() { + if (changeQuorumCloudDatabaseBuilder_ == null) { if (!(actionCase_ == 28)) { action_ = - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.getDefaultInstance(); + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.getDefaultInstance(); } - reconfigureCloudDatabaseBuilder_ = + changeQuorumCloudDatabaseBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction, - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.Builder, - com.google.spanner.executor.v1.ReconfigureCloudDatabaseActionOrBuilder>( - (com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction) action_, + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction, + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.Builder, + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseActionOrBuilder>( + (com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) action_, getParentForChildren(), isClean()); action_ = null; } actionCase_ = 28; onChanged(); - return reconfigureCloudDatabaseBuilder_; + return changeQuorumCloudDatabaseBuilder_; } @java.lang.Override diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/AdminActionOrBuilder.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/AdminActionOrBuilder.java index 123e08d1635..a7279dc6cb9 100644 --- a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/AdminActionOrBuilder.java +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/AdminActionOrBuilder.java @@ -1029,43 +1029,43 @@ public interface AdminActionOrBuilder * * *
-   * Action that reconfigures a Cloud Spanner database.
+   * Action that changes quorum of a Cloud Spanner database.
    * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * * - * @return Whether the reconfigureCloudDatabase field is set. + * @return Whether the changeQuorumCloudDatabase field is set. */ - boolean hasReconfigureCloudDatabase(); + boolean hasChangeQuorumCloudDatabase(); /** * * *
-   * Action that reconfigures a Cloud Spanner database.
+   * Action that changes quorum of a Cloud Spanner database.
    * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * * - * @return The reconfigureCloudDatabase. + * @return The changeQuorumCloudDatabase. */ - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction getReconfigureCloudDatabase(); + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction getChangeQuorumCloudDatabase(); /** * * *
-   * Action that reconfigures a Cloud Spanner database.
+   * Action that changes quorum of a Cloud Spanner database.
    * 
* * - * .google.spanner.executor.v1.ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + * .google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; * */ - com.google.spanner.executor.v1.ReconfigureCloudDatabaseActionOrBuilder - getReconfigureCloudDatabaseOrBuilder(); + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseActionOrBuilder + getChangeQuorumCloudDatabaseOrBuilder(); com.google.spanner.executor.v1.AdminAction.ActionCase getActionCase(); } diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/ReconfigureCloudDatabaseAction.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/ChangeQuorumCloudDatabaseAction.java similarity index 80% rename from proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/ReconfigureCloudDatabaseAction.java rename to proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/ChangeQuorumCloudDatabaseAction.java index 74a5837699d..88b3c28899f 100644 --- a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/ReconfigureCloudDatabaseAction.java +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/ChangeQuorumCloudDatabaseAction.java @@ -23,23 +23,23 @@ * * *
- * Action that reconfigures a Cloud Spanner database.
+ * Action that changes quorum of a Cloud Spanner database.
  * 
* - * Protobuf type {@code google.spanner.executor.v1.ReconfigureCloudDatabaseAction} + * Protobuf type {@code google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction} */ -public final class ReconfigureCloudDatabaseAction extends com.google.protobuf.GeneratedMessageV3 +public final class ChangeQuorumCloudDatabaseAction extends com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:google.spanner.executor.v1.ReconfigureCloudDatabaseAction) - ReconfigureCloudDatabaseActionOrBuilder { + // @@protoc_insertion_point(message_implements:google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) + ChangeQuorumCloudDatabaseActionOrBuilder { private static final long serialVersionUID = 0L; - // Use ReconfigureCloudDatabaseAction.newBuilder() to construct. - private ReconfigureCloudDatabaseAction( + // Use ChangeQuorumCloudDatabaseAction.newBuilder() to construct. + private ChangeQuorumCloudDatabaseAction( com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); } - private ReconfigureCloudDatabaseAction() { + private ChangeQuorumCloudDatabaseAction() { databaseUri_ = ""; servingLocations_ = com.google.protobuf.LazyStringArrayList.emptyList(); } @@ -47,22 +47,22 @@ private ReconfigureCloudDatabaseAction() { @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ReconfigureCloudDatabaseAction(); + return new ChangeQuorumCloudDatabaseAction(); } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.spanner.executor.v1.CloudExecutorProto - .internal_static_google_spanner_executor_v1_ReconfigureCloudDatabaseAction_descriptor; + .internal_static_google_spanner_executor_v1_ChangeQuorumCloudDatabaseAction_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.spanner.executor.v1.CloudExecutorProto - .internal_static_google_spanner_executor_v1_ReconfigureCloudDatabaseAction_fieldAccessorTable + .internal_static_google_spanner_executor_v1_ChangeQuorumCloudDatabaseAction_fieldAccessorTable .ensureFieldAccessorsInitialized( - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.class, - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.Builder.class); + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.class, + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.Builder.class); } private int bitField0_; @@ -74,7 +74,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * * *
-   * The fully qualified uri of the database to be reconfigured.
+   * The fully qualified uri of the database whose quorum has to be changed.
    * 
* * optional string database_uri = 1; @@ -89,7 +89,7 @@ public boolean hasDatabaseUri() { * * *
-   * The fully qualified uri of the database to be reconfigured.
+   * The fully qualified uri of the database whose quorum has to be changed.
    * 
* * optional string database_uri = 1; @@ -112,7 +112,7 @@ public java.lang.String getDatabaseUri() { * * *
-   * The fully qualified uri of the database to be reconfigured.
+   * The fully qualified uri of the database whose quorum has to be changed.
    * 
* * optional string database_uri = 1; @@ -246,11 +246,11 @@ public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } - if (!(obj instanceof com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction)) { + if (!(obj instanceof com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction)) { return super.equals(obj); } - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction other = - (com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction) obj; + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction other = + (com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) obj; if (hasDatabaseUri() != other.hasDatabaseUri()) return false; if (hasDatabaseUri()) { @@ -281,71 +281,71 @@ public int hashCode() { return hash; } - public static com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction parseFrom( + public static com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction parseFrom( + public static com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction parseFrom( + public static com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction parseFrom( + public static com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { + public static com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction parseFrom( + public static com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction parseFrom( + public static com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction parseFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } - public static com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction parseFrom( + public static com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } - public static com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction parseDelimitedFrom( + public static com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction parseDelimitedFrom( + public static com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } - public static com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction parseFrom( + public static com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } - public static com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction parseFrom( + public static com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -363,7 +363,7 @@ public static Builder newBuilder() { } public static Builder newBuilder( - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction prototype) { + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @@ -381,31 +381,31 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * *
-   * Action that reconfigures a Cloud Spanner database.
+   * Action that changes quorum of a Cloud Spanner database.
    * 
* - * Protobuf type {@code google.spanner.executor.v1.ReconfigureCloudDatabaseAction} + * Protobuf type {@code google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:google.spanner.executor.v1.ReconfigureCloudDatabaseAction) - com.google.spanner.executor.v1.ReconfigureCloudDatabaseActionOrBuilder { + // @@protoc_insertion_point(builder_implements:google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseActionOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.spanner.executor.v1.CloudExecutorProto - .internal_static_google_spanner_executor_v1_ReconfigureCloudDatabaseAction_descriptor; + .internal_static_google_spanner_executor_v1_ChangeQuorumCloudDatabaseAction_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.spanner.executor.v1.CloudExecutorProto - .internal_static_google_spanner_executor_v1_ReconfigureCloudDatabaseAction_fieldAccessorTable + .internal_static_google_spanner_executor_v1_ChangeQuorumCloudDatabaseAction_fieldAccessorTable .ensureFieldAccessorsInitialized( - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.class, - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.Builder.class); + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.class, + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.Builder.class); } - // Construct using com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.newBuilder() + // Construct using com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.newBuilder() private Builder() {} private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { @@ -424,18 +424,18 @@ public Builder clear() { @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.spanner.executor.v1.CloudExecutorProto - .internal_static_google_spanner_executor_v1_ReconfigureCloudDatabaseAction_descriptor; + .internal_static_google_spanner_executor_v1_ChangeQuorumCloudDatabaseAction_descriptor; } @java.lang.Override - public com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction + public com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction getDefaultInstanceForType() { - return com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.getDefaultInstance(); + return com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.getDefaultInstance(); } @java.lang.Override - public com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction build() { - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction result = buildPartial(); + public com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction build() { + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } @@ -443,9 +443,9 @@ public com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction build() { } @java.lang.Override - public com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction buildPartial() { - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction result = - new com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction(this); + public com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction buildPartial() { + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction result = + new com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction(this); if (bitField0_ != 0) { buildPartial0(result); } @@ -454,7 +454,7 @@ public com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction buildPartia } private void buildPartial0( - com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction result) { + com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction result) { int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { @@ -503,17 +503,17 @@ public Builder addRepeatedField( @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction) { - return mergeFrom((com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction) other); + if (other instanceof com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) { + return mergeFrom((com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction other) { + public Builder mergeFrom(com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction other) { if (other - == com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction.getDefaultInstance()) + == com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction.getDefaultInstance()) return this; if (other.hasDatabaseUri()) { databaseUri_ = other.databaseUri_; @@ -593,7 +593,7 @@ public Builder mergeFrom( * * *
-     * The fully qualified uri of the database to be reconfigured.
+     * The fully qualified uri of the database whose quorum has to be changed.
      * 
* * optional string database_uri = 1; @@ -607,7 +607,7 @@ public boolean hasDatabaseUri() { * * *
-     * The fully qualified uri of the database to be reconfigured.
+     * The fully qualified uri of the database whose quorum has to be changed.
      * 
* * optional string database_uri = 1; @@ -629,7 +629,7 @@ public java.lang.String getDatabaseUri() { * * *
-     * The fully qualified uri of the database to be reconfigured.
+     * The fully qualified uri of the database whose quorum has to be changed.
      * 
* * optional string database_uri = 1; @@ -651,7 +651,7 @@ public com.google.protobuf.ByteString getDatabaseUriBytes() { * * *
-     * The fully qualified uri of the database to be reconfigured.
+     * The fully qualified uri of the database whose quorum has to be changed.
      * 
* * optional string database_uri = 1; @@ -672,7 +672,7 @@ public Builder setDatabaseUri(java.lang.String value) { * * *
-     * The fully qualified uri of the database to be reconfigured.
+     * The fully qualified uri of the database whose quorum has to be changed.
      * 
* * optional string database_uri = 1; @@ -689,7 +689,7 @@ public Builder clearDatabaseUri() { * * *
-     * The fully qualified uri of the database to be reconfigured.
+     * The fully qualified uri of the database whose quorum has to be changed.
      * 
* * optional string database_uri = 1; @@ -893,25 +893,26 @@ public final Builder mergeUnknownFields( return super.mergeUnknownFields(unknownFields); } - // @@protoc_insertion_point(builder_scope:google.spanner.executor.v1.ReconfigureCloudDatabaseAction) + // @@protoc_insertion_point(builder_scope:google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) } - // @@protoc_insertion_point(class_scope:google.spanner.executor.v1.ReconfigureCloudDatabaseAction) - private static final com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction + // @@protoc_insertion_point(class_scope:google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) + private static final com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction DEFAULT_INSTANCE; static { - DEFAULT_INSTANCE = new com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction(); + DEFAULT_INSTANCE = new com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction(); } - public static com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction getDefaultInstance() { + public static com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction + getDefaultInstance() { return DEFAULT_INSTANCE; } - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { @java.lang.Override - public ReconfigureCloudDatabaseAction parsePartialFrom( + public ChangeQuorumCloudDatabaseAction parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -930,17 +931,18 @@ public ReconfigureCloudDatabaseAction parsePartialFrom( } }; - public static com.google.protobuf.Parser parser() { + public static com.google.protobuf.Parser parser() { return PARSER; } @java.lang.Override - public com.google.protobuf.Parser getParserForType() { + public com.google.protobuf.Parser getParserForType() { return PARSER; } @java.lang.Override - public com.google.spanner.executor.v1.ReconfigureCloudDatabaseAction getDefaultInstanceForType() { + public com.google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction + getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/ReconfigureCloudDatabaseActionOrBuilder.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/ChangeQuorumCloudDatabaseActionOrBuilder.java similarity index 89% rename from proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/ReconfigureCloudDatabaseActionOrBuilder.java rename to proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/ChangeQuorumCloudDatabaseActionOrBuilder.java index 97a1ff2c5ef..772e94530be 100644 --- a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/ReconfigureCloudDatabaseActionOrBuilder.java +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/ChangeQuorumCloudDatabaseActionOrBuilder.java @@ -19,16 +19,16 @@ // Protobuf Java Version: 3.25.2 package com.google.spanner.executor.v1; -public interface ReconfigureCloudDatabaseActionOrBuilder +public interface ChangeQuorumCloudDatabaseActionOrBuilder extends - // @@protoc_insertion_point(interface_extends:google.spanner.executor.v1.ReconfigureCloudDatabaseAction) + // @@protoc_insertion_point(interface_extends:google.spanner.executor.v1.ChangeQuorumCloudDatabaseAction) com.google.protobuf.MessageOrBuilder { /** * * *
-   * The fully qualified uri of the database to be reconfigured.
+   * The fully qualified uri of the database whose quorum has to be changed.
    * 
* * optional string database_uri = 1; @@ -40,7 +40,7 @@ public interface ReconfigureCloudDatabaseActionOrBuilder * * *
-   * The fully qualified uri of the database to be reconfigured.
+   * The fully qualified uri of the database whose quorum has to be changed.
    * 
* * optional string database_uri = 1; @@ -52,7 +52,7 @@ public interface ReconfigureCloudDatabaseActionOrBuilder * * *
-   * The fully qualified uri of the database to be reconfigured.
+   * The fully qualified uri of the database whose quorum has to be changed.
    * 
* * optional string database_uri = 1; diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/CloudExecutorProto.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/CloudExecutorProto.java index 67a4167e504..bd615eaeeb5 100644 --- a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/CloudExecutorProto.java +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/CloudExecutorProto.java @@ -193,9 +193,9 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_spanner_executor_v1_DropCloudDatabaseAction_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_spanner_executor_v1_ReconfigureCloudDatabaseAction_descriptor; + internal_static_google_spanner_executor_v1_ChangeQuorumCloudDatabaseAction_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_spanner_executor_v1_ReconfigureCloudDatabaseAction_fieldAccessorTable; + internal_static_google_spanner_executor_v1_ChangeQuorumCloudDatabaseAction_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_spanner_executor_v1_ListCloudDatabasesAction_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -348,6 +348,14 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_spanner_executor_v1_HeartbeatRecord_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_spanner_executor_v1_HeartbeatRecord_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_executor_v1_SpannerOptions_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_executor_v1_SpannerOptions_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_executor_v1_SessionPoolOptions_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_executor_v1_SessionPoolOptions_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -375,430 +383,439 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "tor.v1.SpannerAction\"r\n\032SpannerAsyncActi" + "onResponse\022\021\n\taction_id\030\001 \001(\005\022A\n\007outcome" + "\030\002 \001(\01320.google.spanner.executor.v1.Span" - + "nerActionOutcome\"\331\t\n\rSpannerAction\022\025\n\rda" - + "tabase_path\030\001 \001(\t\022C\n\005start\030\n \001(\01322.googl" - + "e.spanner.executor.v1.StartTransactionAc" - + "tionH\000\022E\n\006finish\030\013 \001(\01323.google.spanner." - + "executor.v1.FinishTransactionActionH\000\0226\n" - + "\004read\030\024 \001(\0132&.google.spanner.executor.v1" - + ".ReadActionH\000\0228\n\005query\030\025 \001(\0132\'.google.sp" - + "anner.executor.v1.QueryActionH\000\022>\n\010mutat" - + "ion\030\026 \001(\0132*.google.spanner.executor.v1.M" - + "utationActionH\000\0224\n\003dml\030\027 \001(\0132%.google.sp" - + "anner.executor.v1.DmlActionH\000\022?\n\tbatch_d" - + "ml\030\030 \001(\0132*.google.spanner.executor.v1.Ba" - + "tchDmlActionH\000\022A\n\005write\030\031 \001(\01320.google.s" - + "panner.executor.v1.WriteMutationsActionH" - + "\000\022Q\n\022partitioned_update\030\033 \001(\01323.google.s" - + "panner.executor.v1.PartitionedUpdateActi" - + "onH\000\0228\n\005admin\030\036 \001(\0132\'.google.spanner.exe" - + "cutor.v1.AdminActionH\000\022R\n\017start_batch_tx" - + "n\030( \001(\01327.google.spanner.executor.v1.Sta" - + "rtBatchTransactionActionH\000\022R\n\017close_batc" - + "h_txn\030) \001(\01327.google.spanner.executor.v1" - + ".CloseBatchTransactionActionH\000\022d\n\033genera" - + "te_db_partitions_read\030* \001(\0132=.google.spa" - + "nner.executor.v1.GenerateDbPartitionsFor" - + "ReadActionH\000\022f\n\034generate_db_partitions_q" - + "uery\030+ \001(\0132>.google.spanner.executor.v1." - + "GenerateDbPartitionsForQueryActionH\000\022O\n\021" - + "execute_partition\030, \001(\01322.google.spanner" - + ".executor.v1.ExecutePartitionActionH\000\022[\n" - + "\033execute_change_stream_query\0302 \001(\01324.goo" - + "gle.spanner.executor.v1.ExecuteChangeStr" - + "eamQueryH\000B\010\n\006action\"\212\001\n\nReadAction\022\r\n\005t" - + "able\030\001 \001(\t\022\022\n\005index\030\002 \001(\tH\000\210\001\001\022\016\n\006column" - + "\030\003 \003(\t\0220\n\004keys\030\004 \001(\0132\".google.spanner.ex" - + "ecutor.v1.KeySet\022\r\n\005limit\030\005 \001(\005B\010\n\006_inde" - + "x\"\321\001\n\013QueryAction\022\013\n\003sql\030\001 \001(\t\022A\n\006params" - + "\030\002 \003(\01321.google.spanner.executor.v1.Quer" - + "yAction.Parameter\032r\n\tParameter\022\014\n\004name\030\001" - + " \001(\t\022%\n\004type\030\002 \001(\0132\027.google.spanner.v1.T" - + "ype\0220\n\005value\030\003 \001(\0132!.google.spanner.exec" - + "utor.v1.Value\"\206\001\n\tDmlAction\0227\n\006update\030\001 " - + "\001(\0132\'.google.spanner.executor.v1.QueryAc" - + "tion\022$\n\027autocommit_if_supported\030\002 \001(\010H\000\210" - + "\001\001B\032\n\030_autocommit_if_supported\"J\n\016BatchD" - + "mlAction\0228\n\007updates\030\001 \003(\0132\'.google.spann" - + "er.executor.v1.QueryAction\"\311\003\n\005Value\022\021\n\007" - + "is_null\030\001 \001(\010H\000\022\023\n\tint_value\030\002 \001(\003H\000\022\024\n\n" - + "bool_value\030\003 \001(\010H\000\022\026\n\014double_value\030\004 \001(\001" - + "H\000\022\025\n\013bytes_value\030\005 \001(\014H\000\022\026\n\014string_valu" - + "e\030\006 \001(\tH\000\022=\n\014struct_value\030\007 \001(\0132%.google" - + ".spanner.executor.v1.ValueListH\000\0225\n\017time" - + "stamp_value\030\010 \001(\0132\032.google.protobuf.Time" - + "stampH\000\022\031\n\017date_days_value\030\t \001(\005H\000\022\035\n\023is" - + "_commit_timestamp\030\n \001(\010H\000\022<\n\013array_value" - + "\030\013 \001(\0132%.google.spanner.executor.v1.Valu" - + "eListH\000\0220\n\narray_type\030\014 \001(\0132\027.google.spa" - + "nner.v1.TypeH\001\210\001\001B\014\n\nvalue_typeB\r\n\013_arra" - + "y_type\"\237\002\n\010KeyRange\0224\n\005start\030\001 \001(\0132%.goo" - + "gle.spanner.executor.v1.ValueList\0224\n\005lim" - + "it\030\002 \001(\0132%.google.spanner.executor.v1.Va" - + "lueList\022<\n\004type\030\003 \001(\0162).google.spanner.e" - + "xecutor.v1.KeyRange.TypeH\000\210\001\001\"`\n\004Type\022\024\n" - + "\020TYPE_UNSPECIFIED\020\000\022\021\n\rCLOSED_CLOSED\020\001\022\017" - + "\n\013CLOSED_OPEN\020\002\022\017\n\013OPEN_CLOSED\020\003\022\r\n\tOPEN" - + "_OPEN\020\004B\007\n\005_type\"\200\001\n\006KeySet\0224\n\005point\030\001 \003" - + "(\0132%.google.spanner.executor.v1.ValueLis" - + "t\0223\n\005range\030\002 \003(\0132$.google.spanner.execut" - + "or.v1.KeyRange\022\013\n\003all\030\003 \001(\010\"=\n\tValueList" - + "\0220\n\005value\030\001 \003(\0132!.google.spanner.executo" - + "r.v1.Value\"\274\005\n\016MutationAction\022;\n\003mod\030\001 \003" - + "(\0132..google.spanner.executor.v1.Mutation" - + "Action.Mod\032z\n\nInsertArgs\022\016\n\006column\030\001 \003(\t" - + "\022%\n\004type\030\002 \003(\0132\027.google.spanner.v1.Type\022" - + "5\n\006values\030\003 \003(\0132%.google.spanner.executo" - + "r.v1.ValueList\032z\n\nUpdateArgs\022\016\n\006column\030\001" - + " \003(\t\022%\n\004type\030\002 \003(\0132\027.google.spanner.v1.T" - + "ype\0225\n\006values\030\003 \003(\0132%.google.spanner.exe" - + "cutor.v1.ValueList\032\364\002\n\003Mod\022\r\n\005table\030\001 \001(" - + "\t\022E\n\006insert\030\002 \001(\01325.google.spanner.execu" - + "tor.v1.MutationAction.InsertArgs\022E\n\006upda" - + "te\030\003 \001(\01325.google.spanner.executor.v1.Mu" - + "tationAction.UpdateArgs\022O\n\020insert_or_upd" - + "ate\030\004 \001(\01325.google.spanner.executor.v1.M" - + "utationAction.InsertArgs\022F\n\007replace\030\005 \001(" - + "\01325.google.spanner.executor.v1.MutationA" - + "ction.InsertArgs\0227\n\013delete_keys\030\006 \001(\0132\"." - + "google.spanner.executor.v1.KeySet\"T\n\024Wri" - + "teMutationsAction\022<\n\010mutation\030\001 \001(\0132*.go" - + "ogle.spanner.executor.v1.MutationAction\"" - + "\337\002\n\027PartitionedUpdateAction\022i\n\007options\030\001" - + " \001(\0132S.google.spanner.executor.v1.Partit" - + "ionedUpdateAction.ExecutePartitionedUpda" - + "teOptionsH\000\210\001\001\0227\n\006update\030\002 \001(\0132\'.google." - + "spanner.executor.v1.QueryAction\032\223\001\n\037Exec" - + "utePartitionedUpdateOptions\022E\n\014rpc_prior" - + "ity\030\001 \001(\0162*.google.spanner.v1.RequestOpt" - + "ions.PriorityH\000\210\001\001\022\020\n\003tag\030\002 \001(\tH\001\210\001\001B\017\n\r" - + "_rpc_priorityB\006\n\004_tagB\n\n\010_options\"\256\002\n\026St" - + "artTransactionAction\022A\n\013concurrency\030\001 \001(" - + "\0132\'.google.spanner.executor.v1.Concurren" - + "cyH\000\210\001\001\0228\n\005table\030\002 \003(\0132).google.spanner." - + "executor.v1.TableMetadata\022\030\n\020transaction" - + "_seed\030\003 \001(\t\022W\n\021execution_options\030\004 \001(\01327" - + ".google.spanner.executor.v1.TransactionE" - + "xecutionOptionsH\001\210\001\001B\016\n\014_concurrencyB\024\n\022" - + "_execution_options\"\256\002\n\013Concurrency\022\033\n\021st" - + "aleness_seconds\030\001 \001(\001H\000\022#\n\031min_read_time" - + "stamp_micros\030\002 \001(\003H\000\022\037\n\025max_staleness_se" - + "conds\030\003 \001(\001H\000\022 \n\026exact_timestamp_micros\030" - + "\004 \001(\003H\000\022\020\n\006strong\030\005 \001(\010H\000\022\017\n\005batch\030\006 \001(\010" - + "H\000\022\033\n\023snapshot_epoch_read\030\007 \001(\010\022!\n\031snaps" - + "hot_epoch_root_table\030\010 \001(\t\022#\n\033batch_read" - + "_timestamp_micros\030\t \001(\003B\022\n\020concurrency_m" - + "ode\"\231\001\n\rTableMetadata\022\014\n\004name\030\001 \001(\t\022:\n\006c" - + "olumn\030\002 \003(\0132*.google.spanner.executor.v1" - + ".ColumnMetadata\022>\n\nkey_column\030\003 \003(\0132*.go" - + "ogle.spanner.executor.v1.ColumnMetadata\"" - + "E\n\016ColumnMetadata\022\014\n\004name\030\001 \001(\t\022%\n\004type\030" - + "\002 \001(\0132\027.google.spanner.v1.Type\"1\n\033Transa" - + "ctionExecutionOptions\022\022\n\noptimistic\030\001 \001(" - + "\010\"\230\001\n\027FinishTransactionAction\022F\n\004mode\030\001 " - + "\001(\01628.google.spanner.executor.v1.FinishT" - + "ransactionAction.Mode\"5\n\004Mode\022\024\n\020MODE_UN" - + "SPECIFIED\020\000\022\n\n\006COMMIT\020\001\022\013\n\007ABANDON\020\002\"\305\023\n" - + "\013AdminAction\022a\n\033create_user_instance_con" - + "fig\030\001 \001(\0132:.google.spanner.executor.v1.C" - + "reateUserInstanceConfigActionH\000\022a\n\033updat" - + "e_user_instance_config\030\002 \001(\0132:.google.sp" - + "anner.executor.v1.UpdateUserInstanceConf" - + "igActionH\000\022a\n\033delete_user_instance_confi" - + "g\030\003 \001(\0132:.google.spanner.executor.v1.Del" - + "eteUserInstanceConfigActionH\000\022]\n\031get_clo" - + "ud_instance_config\030\004 \001(\01328.google.spanne" - + "r.executor.v1.GetCloudInstanceConfigActi" - + "onH\000\022[\n\025list_instance_configs\030\005 \001(\0132:.go" - + "ogle.spanner.executor.v1.ListCloudInstan" - + "ceConfigsActionH\000\022V\n\025create_cloud_instan" - + "ce\030\006 \001(\01325.google.spanner.executor.v1.Cr" - + "eateCloudInstanceActionH\000\022V\n\025update_clou" - + "d_instance\030\007 \001(\01325.google.spanner.execut" - + "or.v1.UpdateCloudInstanceActionH\000\022V\n\025del" - + "ete_cloud_instance\030\010 \001(\01325.google.spanne" - + "r.executor.v1.DeleteCloudInstanceActionH" - + "\000\022T\n\024list_cloud_instances\030\t \001(\01324.google" - + ".spanner.executor.v1.ListCloudInstancesA" - + "ctionH\000\022P\n\022get_cloud_instance\030\n \001(\01322.go" - + "ogle.spanner.executor.v1.GetCloudInstanc" - + "eActionH\000\022V\n\025create_cloud_database\030\013 \001(\013" - + "25.google.spanner.executor.v1.CreateClou" - + "dDatabaseActionH\000\022]\n\031update_cloud_databa" - + "se_ddl\030\014 \001(\01328.google.spanner.executor.v" - + "1.UpdateCloudDatabaseDdlActionH\000\022V\n\025upda" - + "te_cloud_database\030\033 \001(\01325.google.spanner" - + ".executor.v1.UpdateCloudDatabaseActionH\000" - + "\022R\n\023drop_cloud_database\030\r \001(\01323.google.s" - + "panner.executor.v1.DropCloudDatabaseActi" - + "onH\000\022T\n\024list_cloud_databases\030\016 \001(\01324.goo" - + "gle.spanner.executor.v1.ListCloudDatabas" - + "esActionH\000\022g\n\036list_cloud_database_operat" - + "ions\030\017 \001(\0132=.google.spanner.executor.v1." - + "ListCloudDatabaseOperationsActionH\000\022X\n\026r" - + "estore_cloud_database\030\020 \001(\01326.google.spa" - + "nner.executor.v1.RestoreCloudDatabaseAct" - + "ionH\000\022P\n\022get_cloud_database\030\021 \001(\01322.goog" - + "le.spanner.executor.v1.GetCloudDatabaseA" - + "ctionH\000\022R\n\023create_cloud_backup\030\022 \001(\01323.g" - + "oogle.spanner.executor.v1.CreateCloudBac" - + "kupActionH\000\022N\n\021copy_cloud_backup\030\023 \001(\01321" - + ".google.spanner.executor.v1.CopyCloudBac" - + "kupActionH\000\022L\n\020get_cloud_backup\030\024 \001(\01320." - + "google.spanner.executor.v1.GetCloudBacku" - + "pActionH\000\022R\n\023update_cloud_backup\030\025 \001(\01323" - + ".google.spanner.executor.v1.UpdateCloudB" - + "ackupActionH\000\022R\n\023delete_cloud_backup\030\026 \001" - + "(\01323.google.spanner.executor.v1.DeleteCl" - + "oudBackupActionH\000\022P\n\022list_cloud_backups\030" - + "\027 \001(\01322.google.spanner.executor.v1.ListC" - + "loudBackupsActionH\000\022c\n\034list_cloud_backup" - + "_operations\030\030 \001(\0132;.google.spanner.execu" - + "tor.v1.ListCloudBackupOperationsActionH\000" - + "\022G\n\rget_operation\030\031 \001(\0132..google.spanner" - + ".executor.v1.GetOperationActionH\000\022M\n\020can" - + "cel_operation\030\032 \001(\01321.google.spanner.exe" - + "cutor.v1.CancelOperationActionH\000\022`\n\032reco" - + "nfigure_cloud_database\030\034 \001(\0132:.google.sp" - + "anner.executor.v1.ReconfigureCloudDataba" - + "seActionH\000B\010\n\006action\"\245\001\n\036CreateUserInsta" + + "nerActionOutcome\"\236\n\n\rSpannerAction\022\025\n\rda" + + "tabase_path\030\001 \001(\t\022C\n\017spanner_options\030\002 \001" + + "(\0132*.google.spanner.executor.v1.SpannerO" + + "ptions\022C\n\005start\030\n \001(\01322.google.spanner.e" + + "xecutor.v1.StartTransactionActionH\000\022E\n\006f" + + "inish\030\013 \001(\01323.google.spanner.executor.v1" + + ".FinishTransactionActionH\000\0226\n\004read\030\024 \001(\013" + + "2&.google.spanner.executor.v1.ReadAction" + + "H\000\0228\n\005query\030\025 \001(\0132\'.google.spanner.execu" + + "tor.v1.QueryActionH\000\022>\n\010mutation\030\026 \001(\0132*" + + ".google.spanner.executor.v1.MutationActi" + + "onH\000\0224\n\003dml\030\027 \001(\0132%.google.spanner.execu" + + "tor.v1.DmlActionH\000\022?\n\tbatch_dml\030\030 \001(\0132*." + + "google.spanner.executor.v1.BatchDmlActio" + + "nH\000\022A\n\005write\030\031 \001(\01320.google.spanner.exec" + + "utor.v1.WriteMutationsActionH\000\022Q\n\022partit" + + "ioned_update\030\033 \001(\01323.google.spanner.exec" + + "utor.v1.PartitionedUpdateActionH\000\0228\n\005adm" + + "in\030\036 \001(\0132\'.google.spanner.executor.v1.Ad" + + "minActionH\000\022R\n\017start_batch_txn\030( \001(\01327.g" + + "oogle.spanner.executor.v1.StartBatchTran" + + "sactionActionH\000\022R\n\017close_batch_txn\030) \001(\013" + + "27.google.spanner.executor.v1.CloseBatch" + + "TransactionActionH\000\022d\n\033generate_db_parti" + + "tions_read\030* \001(\0132=.google.spanner.execut" + + "or.v1.GenerateDbPartitionsForReadActionH" + + "\000\022f\n\034generate_db_partitions_query\030+ \001(\0132" + + ">.google.spanner.executor.v1.GenerateDbP" + + "artitionsForQueryActionH\000\022O\n\021execute_par" + + "tition\030, \001(\01322.google.spanner.executor.v" + + "1.ExecutePartitionActionH\000\022[\n\033execute_ch" + + "ange_stream_query\0302 \001(\01324.google.spanner" + + ".executor.v1.ExecuteChangeStreamQueryH\000B" + + "\010\n\006action\"\212\001\n\nReadAction\022\r\n\005table\030\001 \001(\t\022" + + "\022\n\005index\030\002 \001(\tH\000\210\001\001\022\016\n\006column\030\003 \003(\t\0220\n\004k" + + "eys\030\004 \001(\0132\".google.spanner.executor.v1.K" + + "eySet\022\r\n\005limit\030\005 \001(\005B\010\n\006_index\"\321\001\n\013Query" + + "Action\022\013\n\003sql\030\001 \001(\t\022A\n\006params\030\002 \003(\01321.go" + + "ogle.spanner.executor.v1.QueryAction.Par" + + "ameter\032r\n\tParameter\022\014\n\004name\030\001 \001(\t\022%\n\004typ" + + "e\030\002 \001(\0132\027.google.spanner.v1.Type\0220\n\005valu" + + "e\030\003 \001(\0132!.google.spanner.executor.v1.Val" + + "ue\"\206\001\n\tDmlAction\0227\n\006update\030\001 \001(\0132\'.googl" + + "e.spanner.executor.v1.QueryAction\022$\n\027aut" + + "ocommit_if_supported\030\002 \001(\010H\000\210\001\001B\032\n\030_auto" + + "commit_if_supported\"J\n\016BatchDmlAction\0228\n" + + "\007updates\030\001 \003(\0132\'.google.spanner.executor" + + ".v1.QueryAction\"\311\003\n\005Value\022\021\n\007is_null\030\001 \001" + + "(\010H\000\022\023\n\tint_value\030\002 \001(\003H\000\022\024\n\nbool_value\030" + + "\003 \001(\010H\000\022\026\n\014double_value\030\004 \001(\001H\000\022\025\n\013bytes" + + "_value\030\005 \001(\014H\000\022\026\n\014string_value\030\006 \001(\tH\000\022=" + + "\n\014struct_value\030\007 \001(\0132%.google.spanner.ex" + + "ecutor.v1.ValueListH\000\0225\n\017timestamp_value" + + "\030\010 \001(\0132\032.google.protobuf.TimestampH\000\022\031\n\017" + + "date_days_value\030\t \001(\005H\000\022\035\n\023is_commit_tim" + + "estamp\030\n \001(\010H\000\022<\n\013array_value\030\013 \001(\0132%.go" + + "ogle.spanner.executor.v1.ValueListH\000\0220\n\n" + + "array_type\030\014 \001(\0132\027.google.spanner.v1.Typ" + + "eH\001\210\001\001B\014\n\nvalue_typeB\r\n\013_array_type\"\237\002\n\010" + + "KeyRange\0224\n\005start\030\001 \001(\0132%.google.spanner" + + ".executor.v1.ValueList\0224\n\005limit\030\002 \001(\0132%." + + "google.spanner.executor.v1.ValueList\022<\n\004" + + "type\030\003 \001(\0162).google.spanner.executor.v1." + + "KeyRange.TypeH\000\210\001\001\"`\n\004Type\022\024\n\020TYPE_UNSPE" + + "CIFIED\020\000\022\021\n\rCLOSED_CLOSED\020\001\022\017\n\013CLOSED_OP" + + "EN\020\002\022\017\n\013OPEN_CLOSED\020\003\022\r\n\tOPEN_OPEN\020\004B\007\n\005" + + "_type\"\200\001\n\006KeySet\0224\n\005point\030\001 \003(\0132%.google" + + ".spanner.executor.v1.ValueList\0223\n\005range\030" + + "\002 \003(\0132$.google.spanner.executor.v1.KeyRa" + + "nge\022\013\n\003all\030\003 \001(\010\"=\n\tValueList\0220\n\005value\030\001" + + " \003(\0132!.google.spanner.executor.v1.Value\"" + + "\274\005\n\016MutationAction\022;\n\003mod\030\001 \003(\0132..google" + + ".spanner.executor.v1.MutationAction.Mod\032" + + "z\n\nInsertArgs\022\016\n\006column\030\001 \003(\t\022%\n\004type\030\002 " + + "\003(\0132\027.google.spanner.v1.Type\0225\n\006values\030\003" + + " \003(\0132%.google.spanner.executor.v1.ValueL" + + "ist\032z\n\nUpdateArgs\022\016\n\006column\030\001 \003(\t\022%\n\004typ" + + "e\030\002 \003(\0132\027.google.spanner.v1.Type\0225\n\006valu" + + "es\030\003 \003(\0132%.google.spanner.executor.v1.Va" + + "lueList\032\364\002\n\003Mod\022\r\n\005table\030\001 \001(\t\022E\n\006insert" + + "\030\002 \001(\01325.google.spanner.executor.v1.Muta" + + "tionAction.InsertArgs\022E\n\006update\030\003 \001(\01325." + + "google.spanner.executor.v1.MutationActio" + + "n.UpdateArgs\022O\n\020insert_or_update\030\004 \001(\01325" + + ".google.spanner.executor.v1.MutationActi" + + "on.InsertArgs\022F\n\007replace\030\005 \001(\01325.google." + + "spanner.executor.v1.MutationAction.Inser" + + "tArgs\0227\n\013delete_keys\030\006 \001(\0132\".google.span" + + "ner.executor.v1.KeySet\"T\n\024WriteMutations" + + "Action\022<\n\010mutation\030\001 \001(\0132*.google.spanne" + + "r.executor.v1.MutationAction\"\337\002\n\027Partiti" + + "onedUpdateAction\022i\n\007options\030\001 \001(\0132S.goog" + + "le.spanner.executor.v1.PartitionedUpdate" + + "Action.ExecutePartitionedUpdateOptionsH\000" + + "\210\001\001\0227\n\006update\030\002 \001(\0132\'.google.spanner.exe" + + "cutor.v1.QueryAction\032\223\001\n\037ExecutePartitio" + + "nedUpdateOptions\022E\n\014rpc_priority\030\001 \001(\0162*" + + ".google.spanner.v1.RequestOptions.Priori" + + "tyH\000\210\001\001\022\020\n\003tag\030\002 \001(\tH\001\210\001\001B\017\n\r_rpc_priori" + + "tyB\006\n\004_tagB\n\n\010_options\"\256\002\n\026StartTransact" + + "ionAction\022A\n\013concurrency\030\001 \001(\0132\'.google." + + "spanner.executor.v1.ConcurrencyH\000\210\001\001\0228\n\005" + + "table\030\002 \003(\0132).google.spanner.executor.v1" + + ".TableMetadata\022\030\n\020transaction_seed\030\003 \001(\t" + + "\022W\n\021execution_options\030\004 \001(\01327.google.spa" + + "nner.executor.v1.TransactionExecutionOpt" + + "ionsH\001\210\001\001B\016\n\014_concurrencyB\024\n\022_execution_" + + "options\"\256\002\n\013Concurrency\022\033\n\021staleness_sec" + + "onds\030\001 \001(\001H\000\022#\n\031min_read_timestamp_micro" + + "s\030\002 \001(\003H\000\022\037\n\025max_staleness_seconds\030\003 \001(\001" + + "H\000\022 \n\026exact_timestamp_micros\030\004 \001(\003H\000\022\020\n\006" + + "strong\030\005 \001(\010H\000\022\017\n\005batch\030\006 \001(\010H\000\022\033\n\023snaps" + + "hot_epoch_read\030\007 \001(\010\022!\n\031snapshot_epoch_r" + + "oot_table\030\010 \001(\t\022#\n\033batch_read_timestamp_" + + "micros\030\t \001(\003B\022\n\020concurrency_mode\"\231\001\n\rTab" + + "leMetadata\022\014\n\004name\030\001 \001(\t\022:\n\006column\030\002 \003(\013" + + "2*.google.spanner.executor.v1.ColumnMeta" + + "data\022>\n\nkey_column\030\003 \003(\0132*.google.spanne" + + "r.executor.v1.ColumnMetadata\"E\n\016ColumnMe" + + "tadata\022\014\n\004name\030\001 \001(\t\022%\n\004type\030\002 \001(\0132\027.goo" + + "gle.spanner.v1.Type\"1\n\033TransactionExecut" + + "ionOptions\022\022\n\noptimistic\030\001 \001(\010\"\230\001\n\027Finis" + + "hTransactionAction\022F\n\004mode\030\001 \001(\01628.googl" + + "e.spanner.executor.v1.FinishTransactionA" + + "ction.Mode\"5\n\004Mode\022\024\n\020MODE_UNSPECIFIED\020\000" + + "\022\n\n\006COMMIT\020\001\022\013\n\007ABANDON\020\002\"\310\023\n\013AdminActio" + + "n\022a\n\033create_user_instance_config\030\001 \001(\0132:" + + ".google.spanner.executor.v1.CreateUserIn" + + "stanceConfigActionH\000\022a\n\033update_user_inst" + + "ance_config\030\002 \001(\0132:.google.spanner.execu" + + "tor.v1.UpdateUserInstanceConfigActionH\000\022" + + "a\n\033delete_user_instance_config\030\003 \001(\0132:.g" + + "oogle.spanner.executor.v1.DeleteUserInst" + + "anceConfigActionH\000\022]\n\031get_cloud_instance" + + "_config\030\004 \001(\01328.google.spanner.executor." + + "v1.GetCloudInstanceConfigActionH\000\022[\n\025lis" + + "t_instance_configs\030\005 \001(\0132:.google.spanne" + + "r.executor.v1.ListCloudInstanceConfigsAc" + + "tionH\000\022V\n\025create_cloud_instance\030\006 \001(\01325." + + "google.spanner.executor.v1.CreateCloudIn" + + "stanceActionH\000\022V\n\025update_cloud_instance\030" + + "\007 \001(\01325.google.spanner.executor.v1.Updat" + + "eCloudInstanceActionH\000\022V\n\025delete_cloud_i" + + "nstance\030\010 \001(\01325.google.spanner.executor." + + "v1.DeleteCloudInstanceActionH\000\022T\n\024list_c" + + "loud_instances\030\t \001(\01324.google.spanner.ex" + + "ecutor.v1.ListCloudInstancesActionH\000\022P\n\022" + + "get_cloud_instance\030\n \001(\01322.google.spanne" + + "r.executor.v1.GetCloudInstanceActionH\000\022V" + + "\n\025create_cloud_database\030\013 \001(\01325.google.s" + + "panner.executor.v1.CreateCloudDatabaseAc" + + "tionH\000\022]\n\031update_cloud_database_ddl\030\014 \001(" + + "\01328.google.spanner.executor.v1.UpdateClo" + + "udDatabaseDdlActionH\000\022V\n\025update_cloud_da" + + "tabase\030\033 \001(\01325.google.spanner.executor.v" + + "1.UpdateCloudDatabaseActionH\000\022R\n\023drop_cl" + + "oud_database\030\r \001(\01323.google.spanner.exec" + + "utor.v1.DropCloudDatabaseActionH\000\022T\n\024lis" + + "t_cloud_databases\030\016 \001(\01324.google.spanner" + + ".executor.v1.ListCloudDatabasesActionH\000\022" + + "g\n\036list_cloud_database_operations\030\017 \001(\0132" + + "=.google.spanner.executor.v1.ListCloudDa" + + "tabaseOperationsActionH\000\022X\n\026restore_clou" + + "d_database\030\020 \001(\01326.google.spanner.execut" + + "or.v1.RestoreCloudDatabaseActionH\000\022P\n\022ge" + + "t_cloud_database\030\021 \001(\01322.google.spanner." + + "executor.v1.GetCloudDatabaseActionH\000\022R\n\023" + + "create_cloud_backup\030\022 \001(\01323.google.spann" + + "er.executor.v1.CreateCloudBackupActionH\000" + + "\022N\n\021copy_cloud_backup\030\023 \001(\01321.google.spa" + + "nner.executor.v1.CopyCloudBackupActionH\000" + + "\022L\n\020get_cloud_backup\030\024 \001(\01320.google.span" + + "ner.executor.v1.GetCloudBackupActionH\000\022R" + + "\n\023update_cloud_backup\030\025 \001(\01323.google.spa" + + "nner.executor.v1.UpdateCloudBackupAction" + + "H\000\022R\n\023delete_cloud_backup\030\026 \001(\01323.google" + + ".spanner.executor.v1.DeleteCloudBackupAc" + + "tionH\000\022P\n\022list_cloud_backups\030\027 \001(\01322.goo" + + "gle.spanner.executor.v1.ListCloudBackups" + + "ActionH\000\022c\n\034list_cloud_backup_operations" + + "\030\030 \001(\0132;.google.spanner.executor.v1.List" + + "CloudBackupOperationsActionH\000\022G\n\rget_ope" + + "ration\030\031 \001(\0132..google.spanner.executor.v" + + "1.GetOperationActionH\000\022M\n\020cancel_operati" + + "on\030\032 \001(\01321.google.spanner.executor.v1.Ca" + + "ncelOperationActionH\000\022c\n\034change_quorum_c" + + "loud_database\030\034 \001(\0132;.google.spanner.exe" + + "cutor.v1.ChangeQuorumCloudDatabaseAction" + + "H\000B\010\n\006action\"\245\001\n\036CreateUserInstanceConfi" + + "gAction\022\026\n\016user_config_id\030\001 \001(\t\022\022\n\nproje" + + "ct_id\030\002 \001(\t\022\026\n\016base_config_id\030\003 \001(\t\022?\n\010r" + + "eplicas\030\004 \003(\0132-.google.spanner.admin.ins" + + "tance.v1.ReplicaInfo\"\377\001\n\036UpdateUserInsta" + "nceConfigAction\022\026\n\016user_config_id\030\001 \001(\t\022" - + "\022\n\nproject_id\030\002 \001(\t\022\026\n\016base_config_id\030\003 " - + "\001(\t\022?\n\010replicas\030\004 \003(\0132-.google.spanner.a" - + "dmin.instance.v1.ReplicaInfo\"\377\001\n\036UpdateU" - + "serInstanceConfigAction\022\026\n\016user_config_i" - + "d\030\001 \001(\t\022\022\n\nproject_id\030\002 \001(\t\022\031\n\014display_n" - + "ame\030\003 \001(\tH\000\210\001\001\022V\n\006labels\030\004 \003(\0132F.google." - + "spanner.executor.v1.UpdateUserInstanceCo" - + "nfigAction.LabelsEntry\032-\n\013LabelsEntry\022\013\n" - + "\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001B\017\n\r_displa" - + "y_name\"N\n\034GetCloudInstanceConfigAction\022\032" - + "\n\022instance_config_id\030\001 \001(\t\022\022\n\nproject_id" - + "\030\002 \001(\t\"L\n\036DeleteUserInstanceConfigAction" - + "\022\026\n\016user_config_id\030\001 \001(\t\022\022\n\nproject_id\030\002" - + " \001(\t\"\202\001\n\036ListCloudInstanceConfigsAction\022" - + "\022\n\nproject_id\030\001 \001(\t\022\026\n\tpage_size\030\002 \001(\005H\000" - + "\210\001\001\022\027\n\npage_token\030\003 \001(\tH\001\210\001\001B\014\n\n_page_si" - + "zeB\r\n\013_page_token\"\253\003\n\031CreateCloudInstanc" - + "eAction\022\023\n\013instance_id\030\001 \001(\t\022\022\n\nproject_" - + "id\030\002 \001(\t\022\032\n\022instance_config_id\030\003 \001(\t\022\027\n\n" - + "node_count\030\004 \001(\005H\000\210\001\001\022\035\n\020processing_unit" - + "s\030\006 \001(\005H\001\210\001\001\022T\n\022autoscaling_config\030\007 \001(\013" - + "23.google.spanner.admin.instance.v1.Auto" - + "scalingConfigH\002\210\001\001\022Q\n\006labels\030\005 \003(\0132A.goo" - + "gle.spanner.executor.v1.CreateCloudInsta" - + "nceAction.LabelsEntry\032-\n\013LabelsEntry\022\013\n\003" - + "key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001B\r\n\013_node_co" - + "untB\023\n\021_processing_unitsB\025\n\023_autoscaling" - + "_config\"\273\003\n\031UpdateCloudInstanceAction\022\023\n" - + "\013instance_id\030\001 \001(\t\022\022\n\nproject_id\030\002 \001(\t\022\031" - + "\n\014display_name\030\003 \001(\tH\000\210\001\001\022\027\n\nnode_count\030" - + "\004 \001(\005H\001\210\001\001\022\035\n\020processing_units\030\005 \001(\005H\002\210\001" - + "\001\022T\n\022autoscaling_config\030\007 \001(\01323.google.s" - + "panner.admin.instance.v1.AutoscalingConf" - + "igH\003\210\001\001\022Q\n\006labels\030\006 \003(\0132A.google.spanner" - + ".executor.v1.UpdateCloudInstanceAction.L" - + "abelsEntry\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r" - + "\n\005value\030\002 \001(\t:\0028\001B\017\n\r_display_nameB\r\n\013_n" - + "ode_countB\023\n\021_processing_unitsB\025\n\023_autos" - + "caling_config\"D\n\031DeleteCloudInstanceActi" - + "on\022\023\n\013instance_id\030\001 \001(\t\022\022\n\nproject_id\030\002 " - + "\001(\t\"\227\002\n\031CreateCloudDatabaseAction\022\023\n\013ins" - + "tance_id\030\001 \001(\t\022\022\n\nproject_id\030\002 \001(\t\022\023\n\013da" - + "tabase_id\030\003 \001(\t\022\025\n\rsdl_statement\030\004 \003(\t\022M" - + "\n\021encryption_config\030\005 \001(\01322.google.spann" - + "er.admin.database.v1.EncryptionConfig\022\024\n" - + "\007dialect\030\006 \001(\tH\000\210\001\001\022\036\n\021proto_descriptors" - + "\030\007 \001(\014H\001\210\001\001B\n\n\010_dialectB\024\n\022_proto_descri" - + "ptors\"\277\001\n\034UpdateCloudDatabaseDdlAction\022\023" - + "\n\013instance_id\030\001 \001(\t\022\022\n\nproject_id\030\002 \001(\t\022" - + "\023\n\013database_id\030\003 \001(\t\022\025\n\rsdl_statement\030\004 " - + "\003(\t\022\024\n\014operation_id\030\005 \001(\t\022\036\n\021proto_descr" - + "iptors\030\006 \001(\014H\000\210\001\001B\024\n\022_proto_descriptors\"" - + "{\n\031UpdateCloudDatabaseAction\022\023\n\013instance" - + "_id\030\001 \001(\t\022\022\n\nproject_id\030\002 \001(\t\022\025\n\rdatabas" - + "e_name\030\003 \001(\t\022\036\n\026enable_drop_protection\030\004" - + " \001(\010\"W\n\027DropCloudDatabaseAction\022\023\n\013insta" - + "nce_id\030\001 \001(\t\022\022\n\nproject_id\030\002 \001(\t\022\023\n\013data" - + "base_id\030\003 \001(\t\"g\n\036ReconfigureCloudDatabas" - + "eAction\022\031\n\014database_uri\030\001 \001(\tH\000\210\001\001\022\031\n\021se" - + "rving_locations\030\002 \003(\tB\017\n\r_database_uri\"j" - + "\n\030ListCloudDatabasesAction\022\022\n\nproject_id" - + "\030\001 \001(\t\022\023\n\013instance_id\030\002 \001(\t\022\021\n\tpage_size" - + "\030\003 \001(\005\022\022\n\npage_token\030\004 \001(\t\"\234\001\n\030ListCloud" - + "InstancesAction\022\022\n\nproject_id\030\001 \001(\t\022\023\n\006f" - + "ilter\030\002 \001(\tH\000\210\001\001\022\026\n\tpage_size\030\003 \001(\005H\001\210\001\001" - + "\022\027\n\npage_token\030\004 \001(\tH\002\210\001\001B\t\n\007_filterB\014\n\n" - + "_page_sizeB\r\n\013_page_token\"A\n\026GetCloudIns" - + "tanceAction\022\022\n\nproject_id\030\001 \001(\t\022\023\n\013insta" - + "nce_id\030\002 \001(\t\"\203\001\n!ListCloudDatabaseOperat" - + "ionsAction\022\022\n\nproject_id\030\001 \001(\t\022\023\n\013instan" - + "ce_id\030\002 \001(\t\022\016\n\006filter\030\003 \001(\t\022\021\n\tpage_size" - + "\030\004 \001(\005\022\022\n\npage_token\030\005 \001(\t\"\222\001\n\032RestoreCl" - + "oudDatabaseAction\022\022\n\nproject_id\030\001 \001(\t\022\032\n" - + "\022backup_instance_id\030\002 \001(\t\022\021\n\tbackup_id\030\003" - + " \001(\t\022\034\n\024database_instance_id\030\004 \001(\t\022\023\n\013da" - + "tabase_id\030\005 \001(\t\"V\n\026GetCloudDatabaseActio" - + "n\022\022\n\nproject_id\030\001 \001(\t\022\023\n\013instance_id\030\002 \001" - + "(\t\022\023\n\013database_id\030\003 \001(\t\"\350\001\n\027CreateCloudB" - + "ackupAction\022\022\n\nproject_id\030\001 \001(\t\022\023\n\013insta" - + "nce_id\030\002 \001(\t\022\021\n\tbackup_id\030\003 \001(\t\022\023\n\013datab" - + "ase_id\030\004 \001(\t\0224\n\013expire_time\030\005 \001(\0132\032.goog" - + "le.protobuf.TimestampB\003\340A\003\0225\n\014version_ti" - + "me\030\006 \001(\0132\032.google.protobuf.TimestampH\000\210\001" - + "\001B\017\n\r_version_time\"\240\001\n\025CopyCloudBackupAc" + + "\022\n\nproject_id\030\002 \001(\t\022\031\n\014display_name\030\003 \001(" + + "\tH\000\210\001\001\022V\n\006labels\030\004 \003(\0132F.google.spanner." + + "executor.v1.UpdateUserInstanceConfigActi" + + "on.LabelsEntry\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001" + + "(\t\022\r\n\005value\030\002 \001(\t:\0028\001B\017\n\r_display_name\"N" + + "\n\034GetCloudInstanceConfigAction\022\032\n\022instan" + + "ce_config_id\030\001 \001(\t\022\022\n\nproject_id\030\002 \001(\t\"L" + + "\n\036DeleteUserInstanceConfigAction\022\026\n\016user" + + "_config_id\030\001 \001(\t\022\022\n\nproject_id\030\002 \001(\t\"\202\001\n" + + "\036ListCloudInstanceConfigsAction\022\022\n\nproje" + + "ct_id\030\001 \001(\t\022\026\n\tpage_size\030\002 \001(\005H\000\210\001\001\022\027\n\np" + + "age_token\030\003 \001(\tH\001\210\001\001B\014\n\n_page_sizeB\r\n\013_p" + + "age_token\"\253\003\n\031CreateCloudInstanceAction\022" + + "\023\n\013instance_id\030\001 \001(\t\022\022\n\nproject_id\030\002 \001(\t" + + "\022\032\n\022instance_config_id\030\003 \001(\t\022\027\n\nnode_cou" + + "nt\030\004 \001(\005H\000\210\001\001\022\035\n\020processing_units\030\006 \001(\005H" + + "\001\210\001\001\022T\n\022autoscaling_config\030\007 \001(\01323.googl" + + "e.spanner.admin.instance.v1.AutoscalingC" + + "onfigH\002\210\001\001\022Q\n\006labels\030\005 \003(\0132A.google.span" + + "ner.executor.v1.CreateCloudInstanceActio" + + "n.LabelsEntry\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(" + + "\t\022\r\n\005value\030\002 \001(\t:\0028\001B\r\n\013_node_countB\023\n\021_" + + "processing_unitsB\025\n\023_autoscaling_config\"" + + "\273\003\n\031UpdateCloudInstanceAction\022\023\n\013instanc" + + "e_id\030\001 \001(\t\022\022\n\nproject_id\030\002 \001(\t\022\031\n\014displa" + + "y_name\030\003 \001(\tH\000\210\001\001\022\027\n\nnode_count\030\004 \001(\005H\001\210" + + "\001\001\022\035\n\020processing_units\030\005 \001(\005H\002\210\001\001\022T\n\022aut" + + "oscaling_config\030\007 \001(\01323.google.spanner.a" + + "dmin.instance.v1.AutoscalingConfigH\003\210\001\001\022" + + "Q\n\006labels\030\006 \003(\0132A.google.spanner.executo" + + "r.v1.UpdateCloudInstanceAction.LabelsEnt" + + "ry\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030" + + "\002 \001(\t:\0028\001B\017\n\r_display_nameB\r\n\013_node_coun" + + "tB\023\n\021_processing_unitsB\025\n\023_autoscaling_c" + + "onfig\"D\n\031DeleteCloudInstanceAction\022\023\n\013in" + + "stance_id\030\001 \001(\t\022\022\n\nproject_id\030\002 \001(\t\"\227\002\n\031" + + "CreateCloudDatabaseAction\022\023\n\013instance_id" + + "\030\001 \001(\t\022\022\n\nproject_id\030\002 \001(\t\022\023\n\013database_i" + + "d\030\003 \001(\t\022\025\n\rsdl_statement\030\004 \003(\t\022M\n\021encryp" + + "tion_config\030\005 \001(\01322.google.spanner.admin" + + ".database.v1.EncryptionConfig\022\024\n\007dialect" + + "\030\006 \001(\tH\000\210\001\001\022\036\n\021proto_descriptors\030\007 \001(\014H\001" + + "\210\001\001B\n\n\010_dialectB\024\n\022_proto_descriptors\"\277\001" + + "\n\034UpdateCloudDatabaseDdlAction\022\023\n\013instan" + + "ce_id\030\001 \001(\t\022\022\n\nproject_id\030\002 \001(\t\022\023\n\013datab" + + "ase_id\030\003 \001(\t\022\025\n\rsdl_statement\030\004 \003(\t\022\024\n\014o" + + "peration_id\030\005 \001(\t\022\036\n\021proto_descriptors\030\006" + + " \001(\014H\000\210\001\001B\024\n\022_proto_descriptors\"{\n\031Updat" + + "eCloudDatabaseAction\022\023\n\013instance_id\030\001 \001(" + + "\t\022\022\n\nproject_id\030\002 \001(\t\022\025\n\rdatabase_name\030\003" + + " \001(\t\022\036\n\026enable_drop_protection\030\004 \001(\010\"W\n\027" + + "DropCloudDatabaseAction\022\023\n\013instance_id\030\001" + + " \001(\t\022\022\n\nproject_id\030\002 \001(\t\022\023\n\013database_id\030" + + "\003 \001(\t\"h\n\037ChangeQuorumCloudDatabaseAction" + + "\022\031\n\014database_uri\030\001 \001(\tH\000\210\001\001\022\031\n\021serving_l" + + "ocations\030\002 \003(\tB\017\n\r_database_uri\"j\n\030ListC" + + "loudDatabasesAction\022\022\n\nproject_id\030\001 \001(\t\022" + + "\023\n\013instance_id\030\002 \001(\t\022\021\n\tpage_size\030\003 \001(\005\022" + + "\022\n\npage_token\030\004 \001(\t\"\234\001\n\030ListCloudInstanc" + + "esAction\022\022\n\nproject_id\030\001 \001(\t\022\023\n\006filter\030\002" + + " \001(\tH\000\210\001\001\022\026\n\tpage_size\030\003 \001(\005H\001\210\001\001\022\027\n\npag" + + "e_token\030\004 \001(\tH\002\210\001\001B\t\n\007_filterB\014\n\n_page_s" + + "izeB\r\n\013_page_token\"A\n\026GetCloudInstanceAc" + + "tion\022\022\n\nproject_id\030\001 \001(\t\022\023\n\013instance_id\030" + + "\002 \001(\t\"\203\001\n!ListCloudDatabaseOperationsAct" + + "ion\022\022\n\nproject_id\030\001 \001(\t\022\023\n\013instance_id\030\002" + + " \001(\t\022\016\n\006filter\030\003 \001(\t\022\021\n\tpage_size\030\004 \001(\005\022" + + "\022\n\npage_token\030\005 \001(\t\"\341\001\n\032RestoreCloudData" + + "baseAction\022\022\n\nproject_id\030\001 \001(\t\022\032\n\022backup" + + "_instance_id\030\002 \001(\t\022\021\n\tbackup_id\030\003 \001(\t\022\034\n" + + "\024database_instance_id\030\004 \001(\t\022\023\n\013database_" + + "id\030\005 \001(\t\022M\n\021encryption_config\030\007 \001(\01322.go" + + "ogle.spanner.admin.database.v1.Encryptio" + + "nConfig\"V\n\026GetCloudDatabaseAction\022\022\n\npro" + + "ject_id\030\001 \001(\t\022\023\n\013instance_id\030\002 \001(\t\022\023\n\013da" + + "tabase_id\030\003 \001(\t\"\267\002\n\027CreateCloudBackupAct" + + "ion\022\022\n\nproject_id\030\001 \001(\t\022\023\n\013instance_id\030\002" + + " \001(\t\022\021\n\tbackup_id\030\003 \001(\t\022\023\n\013database_id\030\004" + + " \001(\t\0224\n\013expire_time\030\005 \001(\0132\032.google.proto" + + "buf.TimestampB\003\340A\003\0225\n\014version_time\030\006 \001(\013" + + "2\032.google.protobuf.TimestampH\000\210\001\001\022M\n\021enc" + + "ryption_config\030\007 \001(\01322.google.spanner.ad" + + "min.database.v1.EncryptionConfigB\017\n\r_ver" + + "sion_time\"\240\001\n\025CopyCloudBackupAction\022\022\n\np" + + "roject_id\030\001 \001(\t\022\023\n\013instance_id\030\002 \001(\t\022\021\n\t" + + "backup_id\030\003 \001(\t\022\025\n\rsource_backup\030\004 \001(\t\0224" + + "\n\013expire_time\030\005 \001(\0132\032.google.protobuf.Ti" + + "mestampB\003\340A\003\"R\n\024GetCloudBackupAction\022\022\n\n" + + "project_id\030\001 \001(\t\022\023\n\013instance_id\030\002 \001(\t\022\021\n" + + "\tbackup_id\030\003 \001(\t\"\213\001\n\027UpdateCloudBackupAc" + "tion\022\022\n\nproject_id\030\001 \001(\t\022\023\n\013instance_id\030" - + "\002 \001(\t\022\021\n\tbackup_id\030\003 \001(\t\022\025\n\rsource_backu" - + "p\030\004 \001(\t\0224\n\013expire_time\030\005 \001(\0132\032.google.pr" - + "otobuf.TimestampB\003\340A\003\"R\n\024GetCloudBackupA" - + "ction\022\022\n\nproject_id\030\001 \001(\t\022\023\n\013instance_id" - + "\030\002 \001(\t\022\021\n\tbackup_id\030\003 \001(\t\"\213\001\n\027UpdateClou" - + "dBackupAction\022\022\n\nproject_id\030\001 \001(\t\022\023\n\013ins" - + "tance_id\030\002 \001(\t\022\021\n\tbackup_id\030\003 \001(\t\0224\n\013exp" - + "ire_time\030\004 \001(\0132\032.google.protobuf.Timesta" - + "mpB\003\340A\003\"U\n\027DeleteCloudBackupAction\022\022\n\npr" - + "oject_id\030\001 \001(\t\022\023\n\013instance_id\030\002 \001(\t\022\021\n\tb" - + "ackup_id\030\003 \001(\t\"x\n\026ListCloudBackupsAction" - + "\022\022\n\nproject_id\030\001 \001(\t\022\023\n\013instance_id\030\002 \001(" - + "\t\022\016\n\006filter\030\003 \001(\t\022\021\n\tpage_size\030\004 \001(\005\022\022\n\n" - + "page_token\030\005 \001(\t\"\201\001\n\037ListCloudBackupOper" - + "ationsAction\022\022\n\nproject_id\030\001 \001(\t\022\023\n\013inst" - + "ance_id\030\002 \001(\t\022\016\n\006filter\030\003 \001(\t\022\021\n\tpage_si" - + "ze\030\004 \001(\005\022\022\n\npage_token\030\005 \001(\t\"\'\n\022GetOpera" - + "tionAction\022\021\n\toperation\030\001 \001(\t\"*\n\025CancelO" - + "perationAction\022\021\n\toperation\030\001 \001(\t\"\210\001\n\033St" - + "artBatchTransactionAction\0224\n\016batch_txn_t" - + "ime\030\001 \001(\0132\032.google.protobuf.TimestampH\000\022" - + "\r\n\003tid\030\002 \001(\014H\000\022\033\n\023cloud_database_role\030\003 " - + "\001(\tB\007\n\005param\".\n\033CloseBatchTransactionAct" - + "ion\022\017\n\007cleanup\030\001 \001(\010\"\227\002\n!GenerateDbParti" - + "tionsForReadAction\0224\n\004read\030\001 \001(\0132&.googl" - + "e.spanner.executor.v1.ReadAction\0228\n\005tabl" - + "e\030\002 \003(\0132).google.spanner.executor.v1.Tab" - + "leMetadata\022(\n\033desired_bytes_per_partitio" - + "n\030\003 \001(\003H\000\210\001\001\022 \n\023max_partition_count\030\004 \001(" - + "\003H\001\210\001\001B\036\n\034_desired_bytes_per_partitionB\026" - + "\n\024_max_partition_count\"\246\001\n\"GenerateDbPar" - + "titionsForQueryAction\0226\n\005query\030\001 \001(\0132\'.g" - + "oogle.spanner.executor.v1.QueryAction\022(\n" - + "\033desired_bytes_per_partition\030\002 \001(\003H\000\210\001\001B" - + "\036\n\034_desired_bytes_per_partition\"x\n\016Batch" - + "Partition\022\021\n\tpartition\030\001 \001(\014\022\027\n\017partitio" - + "n_token\030\002 \001(\014\022\022\n\005table\030\003 \001(\tH\000\210\001\001\022\022\n\005ind" - + "ex\030\004 \001(\tH\001\210\001\001B\010\n\006_tableB\010\n\006_index\"W\n\026Exe" - + "cutePartitionAction\022=\n\tpartition\030\001 \001(\0132*" - + ".google.spanner.executor.v1.BatchPartiti" - + "on\"\216\003\n\030ExecuteChangeStreamQuery\022\014\n\004name\030" - + "\001 \001(\t\022.\n\nstart_time\030\002 \001(\0132\032.google.proto" - + "buf.Timestamp\0221\n\010end_time\030\003 \001(\0132\032.google" - + ".protobuf.TimestampH\000\210\001\001\022\034\n\017partition_to" - + "ken\030\004 \001(\tH\001\210\001\001\022\024\n\014read_options\030\005 \003(\t\022#\n\026" - + "heartbeat_milliseconds\030\006 \001(\005H\002\210\001\001\022\035\n\020dea" - + "dline_seconds\030\007 \001(\003H\003\210\001\001\022 \n\023cloud_databa" - + "se_role\030\010 \001(\tH\004\210\001\001B\013\n\t_end_timeB\022\n\020_part" - + "ition_tokenB\031\n\027_heartbeat_millisecondsB\023" - + "\n\021_deadline_secondsB\026\n\024_cloud_database_r" - + "ole\"\242\005\n\024SpannerActionOutcome\022\'\n\006status\030\001" - + " \001(\0132\022.google.rpc.StatusH\000\210\001\001\0224\n\013commit_" - + "time\030\002 \001(\0132\032.google.protobuf.TimestampH\001" - + "\210\001\001\022@\n\013read_result\030\003 \001(\0132&.google.spanne" - + "r.executor.v1.ReadResultH\002\210\001\001\022B\n\014query_r" - + "esult\030\004 \001(\0132\'.google.spanner.executor.v1" - + ".QueryResultH\003\210\001\001\022\"\n\025transaction_restart" - + "ed\030\005 \001(\010H\004\210\001\001\022\031\n\014batch_txn_id\030\006 \001(\014H\005\210\001\001" - + "\022@\n\014db_partition\030\007 \003(\0132*.google.spanner." - + "executor.v1.BatchPartition\022B\n\014admin_resu" - + "lt\030\010 \001(\0132\'.google.spanner.executor.v1.Ad" - + "minResultH\006\210\001\001\022\031\n\021dml_rows_modified\030\t \003(" - + "\003\022M\n\025change_stream_records\030\n \003(\0132..googl" - + "e.spanner.executor.v1.ChangeStreamRecord" - + "B\t\n\007_statusB\016\n\014_commit_timeB\016\n\014_read_res" - + "ultB\017\n\r_query_resultB\030\n\026_transaction_res" - + "tartedB\017\n\r_batch_txn_idB\017\n\r_admin_result" - + "\"\231\003\n\013AdminResult\022H\n\017backup_response\030\001 \001(" - + "\0132/.google.spanner.executor.v1.CloudBack" - + "upResponse\022I\n\022operation_response\030\002 \001(\0132-" - + ".google.spanner.executor.v1.OperationRes" - + "ponse\022L\n\021database_response\030\003 \001(\01321.googl" - + "e.spanner.executor.v1.CloudDatabaseRespo" - + "nse\022L\n\021instance_response\030\004 \001(\01321.google." - + "spanner.executor.v1.CloudInstanceRespons" - + "e\022Y\n\030instance_config_response\030\005 \001(\01327.go" - + "ogle.spanner.executor.v1.CloudInstanceCo" - + "nfigResponse\"\353\001\n\023CloudBackupResponse\022@\n\016" - + "listed_backups\030\001 \003(\0132(.google.spanner.ad" - + "min.database.v1.Backup\022?\n\030listed_backup_" - + "operations\030\002 \003(\0132\035.google.longrunning.Op" - + "eration\022\027\n\017next_page_token\030\003 \001(\t\0228\n\006back" - + "up\030\004 \001(\0132(.google.spanner.admin.database" - + ".v1.Backup\"\230\001\n\021OperationResponse\0228\n\021list" - + "ed_operations\030\001 \003(\0132\035.google.longrunning" - + ".Operation\022\027\n\017next_page_token\030\002 \001(\t\0220\n\to" - + "peration\030\003 \001(\0132\035.google.longrunning.Oper" - + "ation\"\264\001\n\025CloudInstanceResponse\022D\n\020liste" - + "d_instances\030\001 \003(\0132*.google.spanner.admin" - + ".instance.v1.Instance\022\027\n\017next_page_token" - + "\030\002 \001(\t\022<\n\010instance\030\003 \001(\0132*.google.spanne" - + "r.admin.instance.v1.Instance\"\324\001\n\033CloudIn" - + "stanceConfigResponse\022Q\n\027listed_instance_" - + "configs\030\001 \003(\01320.google.spanner.admin.ins" - + "tance.v1.InstanceConfig\022\027\n\017next_page_tok" - + "en\030\002 \001(\t\022I\n\017instance_config\030\003 \001(\01320.goog" - + "le.spanner.admin.instance.v1.InstanceCon" - + "fig\"\367\001\n\025CloudDatabaseResponse\022D\n\020listed_" - + "databases\030\001 \003(\0132*.google.spanner.admin.d" - + "atabase.v1.Database\022A\n\032listed_database_o" - + "perations\030\002 \003(\0132\035.google.longrunning.Ope" - + "ration\022\027\n\017next_page_token\030\003 \001(\t\022<\n\010datab" - + "ase\030\004 \001(\0132*.google.spanner.admin.databas" - + "e.v1.Database\"\336\001\n\nReadResult\022\r\n\005table\030\001 " - + "\001(\t\022\022\n\005index\030\002 \001(\tH\000\210\001\001\022\032\n\rrequest_index" - + "\030\003 \001(\005H\001\210\001\001\0222\n\003row\030\004 \003(\0132%.google.spanne" - + "r.executor.v1.ValueList\0224\n\010row_type\030\005 \001(" - + "\0132\035.google.spanner.v1.StructTypeH\002\210\001\001B\010\n" - + "\006_indexB\020\n\016_request_indexB\013\n\t_row_type\"\204", - "\001\n\013QueryResult\0222\n\003row\030\001 \003(\0132%.google.spa" - + "nner.executor.v1.ValueList\0224\n\010row_type\030\002" - + " \001(\0132\035.google.spanner.v1.StructTypeH\000\210\001\001" - + "B\013\n\t_row_type\"\363\001\n\022ChangeStreamRecord\022C\n\013" - + "data_change\030\001 \001(\0132,.google.spanner.execu" - + "tor.v1.DataChangeRecordH\000\022L\n\017child_parti" - + "tion\030\002 \001(\01321.google.spanner.executor.v1." - + "ChildPartitionsRecordH\000\022@\n\theartbeat\030\003 \001" - + "(\0132+.google.spanner.executor.v1.Heartbea" - + "tRecordH\000B\010\n\006record\"\330\004\n\020DataChangeRecord" - + "\022/\n\013commit_time\030\001 \001(\0132\032.google.protobuf." - + "Timestamp\022\027\n\017record_sequence\030\002 \001(\t\022\026\n\016tr" - + "ansaction_id\030\003 \001(\t\022\026\n\016is_last_record\030\004 \001" - + "(\010\022\r\n\005table\030\005 \001(\t\022M\n\014column_types\030\006 \003(\0132" - + "7.google.spanner.executor.v1.DataChangeR" - + "ecord.ColumnType\022>\n\004mods\030\007 \003(\01320.google." - + "spanner.executor.v1.DataChangeRecord.Mod" - + "\022\020\n\010mod_type\030\010 \001(\t\022\032\n\022value_capture_type" - + "\030\t \001(\t\022\024\n\014record_count\030\n \001(\003\022\027\n\017partitio" - + "n_count\030\013 \001(\003\022\027\n\017transaction_tag\030\014 \001(\t\022\035" - + "\n\025is_system_transaction\030\r \001(\010\032Z\n\nColumnT" - + "ype\022\014\n\004name\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022\026\n\016is_pr" - + "imary_key\030\003 \001(\010\022\030\n\020ordinal_position\030\004 \001(" - + "\003\032;\n\003Mod\022\014\n\004keys\030\001 \001(\t\022\022\n\nnew_values\030\002 \001" - + "(\t\022\022\n\nold_values\030\003 \001(\t\"\376\001\n\025ChildPartitio" - + "nsRecord\022.\n\nstart_time\030\001 \001(\0132\032.google.pr" - + "otobuf.Timestamp\022\027\n\017record_sequence\030\002 \001(" - + "\t\022Z\n\020child_partitions\030\003 \003(\0132@.google.spa" - + "nner.executor.v1.ChildPartitionsRecord.C" - + "hildPartition\032@\n\016ChildPartition\022\r\n\005token" - + "\030\001 \001(\t\022\037\n\027parent_partition_tokens\030\002 \003(\t\"" - + "E\n\017HeartbeatRecord\0222\n\016heartbeat_time\030\001 \001" - + "(\0132\032.google.protobuf.Timestamp2\314\001\n\024Spann" - + "erExecutorProxy\022\211\001\n\022ExecuteActionAsync\0225" - + ".google.spanner.executor.v1.SpannerAsync" - + "ActionRequest\0326.google.spanner.executor." - + "v1.SpannerAsyncActionResponse\"\000(\0010\001\032(\312A%" - + "spanner-cloud-executor.googleapis.comBx\n" - + "\036com.google.spanner.executor.v1B\022CloudEx" - + "ecutorProtoP\001Z@cloud.google.com/go/spann" - + "er/executor/apiv1/executorpb;executorpbb" - + "\006proto3" + + "\002 \001(\t\022\021\n\tbackup_id\030\003 \001(\t\0224\n\013expire_time\030" + + "\004 \001(\0132\032.google.protobuf.TimestampB\003\340A\003\"U" + + "\n\027DeleteCloudBackupAction\022\022\n\nproject_id\030" + + "\001 \001(\t\022\023\n\013instance_id\030\002 \001(\t\022\021\n\tbackup_id\030" + + "\003 \001(\t\"x\n\026ListCloudBackupsAction\022\022\n\nproje" + + "ct_id\030\001 \001(\t\022\023\n\013instance_id\030\002 \001(\t\022\016\n\006filt" + + "er\030\003 \001(\t\022\021\n\tpage_size\030\004 \001(\005\022\022\n\npage_toke" + + "n\030\005 \001(\t\"\201\001\n\037ListCloudBackupOperationsAct" + + "ion\022\022\n\nproject_id\030\001 \001(\t\022\023\n\013instance_id\030\002" + + " \001(\t\022\016\n\006filter\030\003 \001(\t\022\021\n\tpage_size\030\004 \001(\005\022" + + "\022\n\npage_token\030\005 \001(\t\"\'\n\022GetOperationActio" + + "n\022\021\n\toperation\030\001 \001(\t\"*\n\025CancelOperationA" + + "ction\022\021\n\toperation\030\001 \001(\t\"\210\001\n\033StartBatchT" + + "ransactionAction\0224\n\016batch_txn_time\030\001 \001(\013" + + "2\032.google.protobuf.TimestampH\000\022\r\n\003tid\030\002 " + + "\001(\014H\000\022\033\n\023cloud_database_role\030\003 \001(\tB\007\n\005pa" + + "ram\".\n\033CloseBatchTransactionAction\022\017\n\007cl" + + "eanup\030\001 \001(\010\"\227\002\n!GenerateDbPartitionsForR" + + "eadAction\0224\n\004read\030\001 \001(\0132&.google.spanner" + + ".executor.v1.ReadAction\0228\n\005table\030\002 \003(\0132)" + + ".google.spanner.executor.v1.TableMetadat" + + "a\022(\n\033desired_bytes_per_partition\030\003 \001(\003H\000" + + "\210\001\001\022 \n\023max_partition_count\030\004 \001(\003H\001\210\001\001B\036\n" + + "\034_desired_bytes_per_partitionB\026\n\024_max_pa" + + "rtition_count\"\246\001\n\"GenerateDbPartitionsFo" + + "rQueryAction\0226\n\005query\030\001 \001(\0132\'.google.spa" + + "nner.executor.v1.QueryAction\022(\n\033desired_" + + "bytes_per_partition\030\002 \001(\003H\000\210\001\001B\036\n\034_desir" + + "ed_bytes_per_partition\"x\n\016BatchPartition" + + "\022\021\n\tpartition\030\001 \001(\014\022\027\n\017partition_token\030\002" + + " \001(\014\022\022\n\005table\030\003 \001(\tH\000\210\001\001\022\022\n\005index\030\004 \001(\tH" + + "\001\210\001\001B\010\n\006_tableB\010\n\006_index\"W\n\026ExecuteParti" + + "tionAction\022=\n\tpartition\030\001 \001(\0132*.google.s" + + "panner.executor.v1.BatchPartition\"\216\003\n\030Ex" + + "ecuteChangeStreamQuery\022\014\n\004name\030\001 \001(\t\022.\n\n" + + "start_time\030\002 \001(\0132\032.google.protobuf.Times" + + "tamp\0221\n\010end_time\030\003 \001(\0132\032.google.protobuf" + + ".TimestampH\000\210\001\001\022\034\n\017partition_token\030\004 \001(\t" + + "H\001\210\001\001\022\024\n\014read_options\030\005 \003(\t\022#\n\026heartbeat" + + "_milliseconds\030\006 \001(\005H\002\210\001\001\022\035\n\020deadline_sec" + + "onds\030\007 \001(\003H\003\210\001\001\022 \n\023cloud_database_role\030\010" + + " \001(\tH\004\210\001\001B\013\n\t_end_timeB\022\n\020_partition_tok" + + "enB\031\n\027_heartbeat_millisecondsB\023\n\021_deadli" + + "ne_secondsB\026\n\024_cloud_database_role\"\242\005\n\024S" + + "pannerActionOutcome\022\'\n\006status\030\001 \001(\0132\022.go" + + "ogle.rpc.StatusH\000\210\001\001\0224\n\013commit_time\030\002 \001(" + + "\0132\032.google.protobuf.TimestampH\001\210\001\001\022@\n\013re" + + "ad_result\030\003 \001(\0132&.google.spanner.executo" + + "r.v1.ReadResultH\002\210\001\001\022B\n\014query_result\030\004 \001" + + "(\0132\'.google.spanner.executor.v1.QueryRes" + + "ultH\003\210\001\001\022\"\n\025transaction_restarted\030\005 \001(\010H" + + "\004\210\001\001\022\031\n\014batch_txn_id\030\006 \001(\014H\005\210\001\001\022@\n\014db_pa" + + "rtition\030\007 \003(\0132*.google.spanner.executor." + + "v1.BatchPartition\022B\n\014admin_result\030\010 \001(\0132" + + "\'.google.spanner.executor.v1.AdminResult" + + "H\006\210\001\001\022\031\n\021dml_rows_modified\030\t \003(\003\022M\n\025chan" + + "ge_stream_records\030\n \003(\0132..google.spanner" + + ".executor.v1.ChangeStreamRecordB\t\n\007_stat" + + "usB\016\n\014_commit_timeB\016\n\014_read_resultB\017\n\r_q" + + "uery_resultB\030\n\026_transaction_restartedB\017\n" + + "\r_batch_txn_idB\017\n\r_admin_result\"\231\003\n\013Admi" + + "nResult\022H\n\017backup_response\030\001 \001(\0132/.googl" + + "e.spanner.executor.v1.CloudBackupRespons" + + "e\022I\n\022operation_response\030\002 \001(\0132-.google.s" + + "panner.executor.v1.OperationResponse\022L\n\021" + + "database_response\030\003 \001(\01321.google.spanner" + + ".executor.v1.CloudDatabaseResponse\022L\n\021in" + + "stance_response\030\004 \001(\01321.google.spanner.e" + + "xecutor.v1.CloudInstanceResponse\022Y\n\030inst" + + "ance_config_response\030\005 \001(\01327.google.span" + + "ner.executor.v1.CloudInstanceConfigRespo" + + "nse\"\353\001\n\023CloudBackupResponse\022@\n\016listed_ba" + + "ckups\030\001 \003(\0132(.google.spanner.admin.datab" + + "ase.v1.Backup\022?\n\030listed_backup_operation" + + "s\030\002 \003(\0132\035.google.longrunning.Operation\022\027" + + "\n\017next_page_token\030\003 \001(\t\0228\n\006backup\030\004 \001(\0132" + + "(.google.spanner.admin.database.v1.Backu" + + "p\"\230\001\n\021OperationResponse\0228\n\021listed_operat" + + "ions\030\001 \003(\0132\035.google.longrunning.Operatio" + + "n\022\027\n\017next_page_token\030\002 \001(\t\0220\n\toperation\030" + + "\003 \001(\0132\035.google.longrunning.Operation\"\264\001\n" + + "\025CloudInstanceResponse\022D\n\020listed_instanc" + + "es\030\001 \003(\0132*.google.spanner.admin.instance" + + ".v1.Instance\022\027\n\017next_page_token\030\002 \001(\t\022<\n" + + "\010instance\030\003 \001(\0132*.google.spanner.admin.i" + + "nstance.v1.Instance\"\324\001\n\033CloudInstanceCon" + + "figResponse\022Q\n\027listed_instance_configs\030\001" + + " \003(\01320.google.spanner.admin.instance.v1." + + "InstanceConfig\022\027\n\017next_page_token\030\002 \001(\t\022" + + "I\n\017instance_config\030\003 \001(\01320.google.spanne" + + "r.admin.instance.v1.InstanceConfig\"\367\001\n\025C" + + "loudDatabaseResponse\022D\n\020listed_databases" + + "\030\001 \003(\0132*.google.spanner.admin.database.v" + + "1.Database\022A\n\032listed_database_operations" + + "\030\002 \003(\0132\035.google.longrunning.Operation\022\027\n" + + "\017next_page_token\030\003 \001(\t\022<\n\010database\030\004 \001(\013" + + "2*.google.spanner.admin.database.v1.Data", + "base\"\336\001\n\nReadResult\022\r\n\005table\030\001 \001(\t\022\022\n\005in" + + "dex\030\002 \001(\tH\000\210\001\001\022\032\n\rrequest_index\030\003 \001(\005H\001\210" + + "\001\001\0222\n\003row\030\004 \003(\0132%.google.spanner.executo" + + "r.v1.ValueList\0224\n\010row_type\030\005 \001(\0132\035.googl" + + "e.spanner.v1.StructTypeH\002\210\001\001B\010\n\006_indexB\020" + + "\n\016_request_indexB\013\n\t_row_type\"\204\001\n\013QueryR" + + "esult\0222\n\003row\030\001 \003(\0132%.google.spanner.exec" + + "utor.v1.ValueList\0224\n\010row_type\030\002 \001(\0132\035.go" + + "ogle.spanner.v1.StructTypeH\000\210\001\001B\013\n\t_row_" + + "type\"\363\001\n\022ChangeStreamRecord\022C\n\013data_chan" + + "ge\030\001 \001(\0132,.google.spanner.executor.v1.Da" + + "taChangeRecordH\000\022L\n\017child_partition\030\002 \001(" + + "\01321.google.spanner.executor.v1.ChildPart" + + "itionsRecordH\000\022@\n\theartbeat\030\003 \001(\0132+.goog" + + "le.spanner.executor.v1.HeartbeatRecordH\000" + + "B\010\n\006record\"\330\004\n\020DataChangeRecord\022/\n\013commi" + + "t_time\030\001 \001(\0132\032.google.protobuf.Timestamp" + + "\022\027\n\017record_sequence\030\002 \001(\t\022\026\n\016transaction" + + "_id\030\003 \001(\t\022\026\n\016is_last_record\030\004 \001(\010\022\r\n\005tab" + + "le\030\005 \001(\t\022M\n\014column_types\030\006 \003(\01327.google." + + "spanner.executor.v1.DataChangeRecord.Col" + + "umnType\022>\n\004mods\030\007 \003(\01320.google.spanner.e" + + "xecutor.v1.DataChangeRecord.Mod\022\020\n\010mod_t" + + "ype\030\010 \001(\t\022\032\n\022value_capture_type\030\t \001(\t\022\024\n" + + "\014record_count\030\n \001(\003\022\027\n\017partition_count\030\013" + + " \001(\003\022\027\n\017transaction_tag\030\014 \001(\t\022\035\n\025is_syst" + + "em_transaction\030\r \001(\010\032Z\n\nColumnType\022\014\n\004na" + + "me\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022\026\n\016is_primary_key" + + "\030\003 \001(\010\022\030\n\020ordinal_position\030\004 \001(\003\032;\n\003Mod\022" + + "\014\n\004keys\030\001 \001(\t\022\022\n\nnew_values\030\002 \001(\t\022\022\n\nold" + + "_values\030\003 \001(\t\"\376\001\n\025ChildPartitionsRecord\022" + + ".\n\nstart_time\030\001 \001(\0132\032.google.protobuf.Ti" + + "mestamp\022\027\n\017record_sequence\030\002 \001(\t\022Z\n\020chil" + + "d_partitions\030\003 \003(\0132@.google.spanner.exec" + + "utor.v1.ChildPartitionsRecord.ChildParti" + + "tion\032@\n\016ChildPartition\022\r\n\005token\030\001 \001(\t\022\037\n" + + "\027parent_partition_tokens\030\002 \003(\t\"E\n\017Heartb" + + "eatRecord\0222\n\016heartbeat_time\030\001 \001(\0132\032.goog" + + "le.protobuf.Timestamp\"^\n\016SpannerOptions\022" + + "L\n\024session_pool_options\030\001 \001(\0132..google.s" + + "panner.executor.v1.SessionPoolOptions\"-\n" + + "\022SessionPoolOptions\022\027\n\017use_multiplexed\030\001" + + " \001(\0102\314\001\n\024SpannerExecutorProxy\022\211\001\n\022Execut" + + "eActionAsync\0225.google.spanner.executor.v" + + "1.SpannerAsyncActionRequest\0326.google.spa" + + "nner.executor.v1.SpannerAsyncActionRespo" + + "nse\"\000(\0010\001\032(\312A%spanner-cloud-executor.goo" + + "gleapis.comBx\n\036com.google.spanner.execut" + + "or.v1B\022CloudExecutorProtoP\001Z@cloud.googl" + + "e.com/go/spanner/executor/apiv1/executor" + + "pb;executorpbb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -839,6 +856,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { internal_static_google_spanner_executor_v1_SpannerAction_descriptor, new java.lang.String[] { "DatabasePath", + "SpannerOptions", "Start", "Finish", "Read", @@ -1095,7 +1113,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "ListCloudBackupOperations", "GetOperation", "CancelOperation", - "ReconfigureCloudDatabase", + "ChangeQuorumCloudDatabase", "Action", }); internal_static_google_spanner_executor_v1_CreateUserInstanceConfigAction_descriptor = @@ -1247,11 +1265,11 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "InstanceId", "ProjectId", "DatabaseId", }); - internal_static_google_spanner_executor_v1_ReconfigureCloudDatabaseAction_descriptor = + internal_static_google_spanner_executor_v1_ChangeQuorumCloudDatabaseAction_descriptor = getDescriptor().getMessageTypes().get(33); - internal_static_google_spanner_executor_v1_ReconfigureCloudDatabaseAction_fieldAccessorTable = + internal_static_google_spanner_executor_v1_ChangeQuorumCloudDatabaseAction_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_spanner_executor_v1_ReconfigureCloudDatabaseAction_descriptor, + internal_static_google_spanner_executor_v1_ChangeQuorumCloudDatabaseAction_descriptor, new java.lang.String[] { "DatabaseUri", "ServingLocations", }); @@ -1293,7 +1311,12 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_executor_v1_RestoreCloudDatabaseAction_descriptor, new java.lang.String[] { - "ProjectId", "BackupInstanceId", "BackupId", "DatabaseInstanceId", "DatabaseId", + "ProjectId", + "BackupInstanceId", + "BackupId", + "DatabaseInstanceId", + "DatabaseId", + "EncryptionConfig", }); internal_static_google_spanner_executor_v1_GetCloudDatabaseAction_descriptor = getDescriptor().getMessageTypes().get(39); @@ -1309,7 +1332,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_executor_v1_CreateCloudBackupAction_descriptor, new java.lang.String[] { - "ProjectId", "InstanceId", "BackupId", "DatabaseId", "ExpireTime", "VersionTime", + "ProjectId", + "InstanceId", + "BackupId", + "DatabaseId", + "ExpireTime", + "VersionTime", + "EncryptionConfig", }); internal_static_google_spanner_executor_v1_CopyCloudBackupAction_descriptor = getDescriptor().getMessageTypes().get(41); @@ -1597,6 +1626,22 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "HeartbeatTime", }); + internal_static_google_spanner_executor_v1_SpannerOptions_descriptor = + getDescriptor().getMessageTypes().get(69); + internal_static_google_spanner_executor_v1_SpannerOptions_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_executor_v1_SpannerOptions_descriptor, + new java.lang.String[] { + "SessionPoolOptions", + }); + internal_static_google_spanner_executor_v1_SessionPoolOptions_descriptor = + getDescriptor().getMessageTypes().get(70); + internal_static_google_spanner_executor_v1_SessionPoolOptions_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_executor_v1_SessionPoolOptions_descriptor, + new java.lang.String[] { + "UseMultiplexed", + }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); registry.add(com.google.api.ClientProto.defaultHost); diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/CreateCloudBackupAction.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/CreateCloudBackupAction.java index f972e1a3e4e..0db92886e4e 100644 --- a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/CreateCloudBackupAction.java +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/CreateCloudBackupAction.java @@ -379,6 +379,60 @@ public com.google.protobuf.TimestampOrBuilder getVersionTimeOrBuilder() { return versionTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : versionTime_; } + public static final int ENCRYPTION_CONFIG_FIELD_NUMBER = 7; + private com.google.spanner.admin.database.v1.EncryptionConfig encryptionConfig_; + /** + * + * + *
+   * The KMS key(s) used to encrypt the backup to be created if the backup
+   * should be CMEK protected.
+   * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + * + * @return Whether the encryptionConfig field is set. + */ + @java.lang.Override + public boolean hasEncryptionConfig() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+   * The KMS key(s) used to encrypt the backup to be created if the backup
+   * should be CMEK protected.
+   * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + * + * @return The encryptionConfig. + */ + @java.lang.Override + public com.google.spanner.admin.database.v1.EncryptionConfig getEncryptionConfig() { + return encryptionConfig_ == null + ? com.google.spanner.admin.database.v1.EncryptionConfig.getDefaultInstance() + : encryptionConfig_; + } + /** + * + * + *
+   * The KMS key(s) used to encrypt the backup to be created if the backup
+   * should be CMEK protected.
+   * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + @java.lang.Override + public com.google.spanner.admin.database.v1.EncryptionConfigOrBuilder + getEncryptionConfigOrBuilder() { + return encryptionConfig_ == null + ? com.google.spanner.admin.database.v1.EncryptionConfig.getDefaultInstance() + : encryptionConfig_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -411,6 +465,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(6, getVersionTime()); } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(7, getEncryptionConfig()); + } getUnknownFields().writeTo(output); } @@ -438,6 +495,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getVersionTime()); } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getEncryptionConfig()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -466,6 +526,10 @@ public boolean equals(final java.lang.Object obj) { if (hasVersionTime()) { if (!getVersionTime().equals(other.getVersionTime())) return false; } + if (hasEncryptionConfig() != other.hasEncryptionConfig()) return false; + if (hasEncryptionConfig()) { + if (!getEncryptionConfig().equals(other.getEncryptionConfig())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -493,6 +557,10 @@ public int hashCode() { hash = (37 * hash) + VERSION_TIME_FIELD_NUMBER; hash = (53 * hash) + getVersionTime().hashCode(); } + if (hasEncryptionConfig()) { + hash = (37 * hash) + ENCRYPTION_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getEncryptionConfig().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -636,6 +704,7 @@ private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { getExpireTimeFieldBuilder(); getVersionTimeFieldBuilder(); + getEncryptionConfigFieldBuilder(); } } @@ -657,6 +726,11 @@ public Builder clear() { versionTimeBuilder_.dispose(); versionTimeBuilder_ = null; } + encryptionConfig_ = null; + if (encryptionConfigBuilder_ != null) { + encryptionConfigBuilder_.dispose(); + encryptionConfigBuilder_ = null; + } return this; } @@ -715,6 +789,11 @@ private void buildPartial0(com.google.spanner.executor.v1.CreateCloudBackupActio versionTimeBuilder_ == null ? versionTime_ : versionTimeBuilder_.build(); to_bitField0_ |= 0x00000002; } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.encryptionConfig_ = + encryptionConfigBuilder_ == null ? encryptionConfig_ : encryptionConfigBuilder_.build(); + to_bitField0_ |= 0x00000004; + } result.bitField0_ |= to_bitField0_; } @@ -790,6 +869,9 @@ public Builder mergeFrom(com.google.spanner.executor.v1.CreateCloudBackupAction if (other.hasVersionTime()) { mergeVersionTime(other.getVersionTime()); } + if (other.hasEncryptionConfig()) { + mergeEncryptionConfig(other.getEncryptionConfig()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -852,6 +934,13 @@ public Builder mergeFrom( bitField0_ |= 0x00000020; break; } // case 50 + case 58: + { + input.readMessage( + getEncryptionConfigFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000040; + break; + } // case 58 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1720,6 +1809,206 @@ public com.google.protobuf.TimestampOrBuilder getVersionTimeOrBuilder() { return versionTimeBuilder_; } + private com.google.spanner.admin.database.v1.EncryptionConfig encryptionConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.database.v1.EncryptionConfig, + com.google.spanner.admin.database.v1.EncryptionConfig.Builder, + com.google.spanner.admin.database.v1.EncryptionConfigOrBuilder> + encryptionConfigBuilder_; + /** + * + * + *
+     * The KMS key(s) used to encrypt the backup to be created if the backup
+     * should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + * + * @return Whether the encryptionConfig field is set. + */ + public boolean hasEncryptionConfig() { + return ((bitField0_ & 0x00000040) != 0); + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the backup to be created if the backup
+     * should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + * + * @return The encryptionConfig. + */ + public com.google.spanner.admin.database.v1.EncryptionConfig getEncryptionConfig() { + if (encryptionConfigBuilder_ == null) { + return encryptionConfig_ == null + ? com.google.spanner.admin.database.v1.EncryptionConfig.getDefaultInstance() + : encryptionConfig_; + } else { + return encryptionConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the backup to be created if the backup
+     * should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + public Builder setEncryptionConfig( + com.google.spanner.admin.database.v1.EncryptionConfig value) { + if (encryptionConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + encryptionConfig_ = value; + } else { + encryptionConfigBuilder_.setMessage(value); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the backup to be created if the backup
+     * should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + public Builder setEncryptionConfig( + com.google.spanner.admin.database.v1.EncryptionConfig.Builder builderForValue) { + if (encryptionConfigBuilder_ == null) { + encryptionConfig_ = builderForValue.build(); + } else { + encryptionConfigBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the backup to be created if the backup
+     * should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + public Builder mergeEncryptionConfig( + com.google.spanner.admin.database.v1.EncryptionConfig value) { + if (encryptionConfigBuilder_ == null) { + if (((bitField0_ & 0x00000040) != 0) + && encryptionConfig_ != null + && encryptionConfig_ + != com.google.spanner.admin.database.v1.EncryptionConfig.getDefaultInstance()) { + getEncryptionConfigBuilder().mergeFrom(value); + } else { + encryptionConfig_ = value; + } + } else { + encryptionConfigBuilder_.mergeFrom(value); + } + if (encryptionConfig_ != null) { + bitField0_ |= 0x00000040; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the backup to be created if the backup
+     * should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + public Builder clearEncryptionConfig() { + bitField0_ = (bitField0_ & ~0x00000040); + encryptionConfig_ = null; + if (encryptionConfigBuilder_ != null) { + encryptionConfigBuilder_.dispose(); + encryptionConfigBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the backup to be created if the backup
+     * should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + public com.google.spanner.admin.database.v1.EncryptionConfig.Builder + getEncryptionConfigBuilder() { + bitField0_ |= 0x00000040; + onChanged(); + return getEncryptionConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the backup to be created if the backup
+     * should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + public com.google.spanner.admin.database.v1.EncryptionConfigOrBuilder + getEncryptionConfigOrBuilder() { + if (encryptionConfigBuilder_ != null) { + return encryptionConfigBuilder_.getMessageOrBuilder(); + } else { + return encryptionConfig_ == null + ? com.google.spanner.admin.database.v1.EncryptionConfig.getDefaultInstance() + : encryptionConfig_; + } + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the backup to be created if the backup
+     * should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.database.v1.EncryptionConfig, + com.google.spanner.admin.database.v1.EncryptionConfig.Builder, + com.google.spanner.admin.database.v1.EncryptionConfigOrBuilder> + getEncryptionConfigFieldBuilder() { + if (encryptionConfigBuilder_ == null) { + encryptionConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.database.v1.EncryptionConfig, + com.google.spanner.admin.database.v1.EncryptionConfig.Builder, + com.google.spanner.admin.database.v1.EncryptionConfigOrBuilder>( + getEncryptionConfig(), getParentForChildren(), isClean()); + encryptionConfig_ = null; + } + return encryptionConfigBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/CreateCloudBackupActionOrBuilder.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/CreateCloudBackupActionOrBuilder.java index 1059f9cf08c..4e6a7b53147 100644 --- a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/CreateCloudBackupActionOrBuilder.java +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/CreateCloudBackupActionOrBuilder.java @@ -209,4 +209,42 @@ public interface CreateCloudBackupActionOrBuilder * optional .google.protobuf.Timestamp version_time = 6; */ com.google.protobuf.TimestampOrBuilder getVersionTimeOrBuilder(); + + /** + * + * + *
+   * The KMS key(s) used to encrypt the backup to be created if the backup
+   * should be CMEK protected.
+   * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + * + * @return Whether the encryptionConfig field is set. + */ + boolean hasEncryptionConfig(); + /** + * + * + *
+   * The KMS key(s) used to encrypt the backup to be created if the backup
+   * should be CMEK protected.
+   * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + * + * @return The encryptionConfig. + */ + com.google.spanner.admin.database.v1.EncryptionConfig getEncryptionConfig(); + /** + * + * + *
+   * The KMS key(s) used to encrypt the backup to be created if the backup
+   * should be CMEK protected.
+   * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + com.google.spanner.admin.database.v1.EncryptionConfigOrBuilder getEncryptionConfigOrBuilder(); } diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/RestoreCloudDatabaseAction.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/RestoreCloudDatabaseAction.java index f511d86774e..111f8441da2 100644 --- a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/RestoreCloudDatabaseAction.java +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/RestoreCloudDatabaseAction.java @@ -67,6 +67,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.spanner.executor.v1.RestoreCloudDatabaseAction.Builder.class); } + private int bitField0_; public static final int PROJECT_ID_FIELD_NUMBER = 1; @SuppressWarnings("serial") @@ -326,6 +327,60 @@ public com.google.protobuf.ByteString getDatabaseIdBytes() { } } + public static final int ENCRYPTION_CONFIG_FIELD_NUMBER = 7; + private com.google.spanner.admin.database.v1.EncryptionConfig encryptionConfig_; + /** + * + * + *
+   * The KMS key(s) used to encrypt the restored database to be created if the
+   * restored database should be CMEK protected.
+   * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + * + * @return Whether the encryptionConfig field is set. + */ + @java.lang.Override + public boolean hasEncryptionConfig() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * The KMS key(s) used to encrypt the restored database to be created if the
+   * restored database should be CMEK protected.
+   * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + * + * @return The encryptionConfig. + */ + @java.lang.Override + public com.google.spanner.admin.database.v1.EncryptionConfig getEncryptionConfig() { + return encryptionConfig_ == null + ? com.google.spanner.admin.database.v1.EncryptionConfig.getDefaultInstance() + : encryptionConfig_; + } + /** + * + * + *
+   * The KMS key(s) used to encrypt the restored database to be created if the
+   * restored database should be CMEK protected.
+   * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + @java.lang.Override + public com.google.spanner.admin.database.v1.EncryptionConfigOrBuilder + getEncryptionConfigOrBuilder() { + return encryptionConfig_ == null + ? com.google.spanner.admin.database.v1.EncryptionConfig.getDefaultInstance() + : encryptionConfig_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -355,6 +410,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(databaseId_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 5, databaseId_); } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(7, getEncryptionConfig()); + } getUnknownFields().writeTo(output); } @@ -379,6 +437,9 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(databaseId_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, databaseId_); } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getEncryptionConfig()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -400,6 +461,10 @@ public boolean equals(final java.lang.Object obj) { if (!getBackupId().equals(other.getBackupId())) return false; if (!getDatabaseInstanceId().equals(other.getDatabaseInstanceId())) return false; if (!getDatabaseId().equals(other.getDatabaseId())) return false; + if (hasEncryptionConfig() != other.hasEncryptionConfig()) return false; + if (hasEncryptionConfig()) { + if (!getEncryptionConfig().equals(other.getEncryptionConfig())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -421,6 +486,10 @@ public int hashCode() { hash = (53 * hash) + getDatabaseInstanceId().hashCode(); hash = (37 * hash) + DATABASE_ID_FIELD_NUMBER; hash = (53 * hash) + getDatabaseId().hashCode(); + if (hasEncryptionConfig()) { + hash = (37 * hash) + ENCRYPTION_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getEncryptionConfig().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -551,10 +620,19 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.spanner.executor.v1.RestoreCloudDatabaseAction.newBuilder() - private Builder() {} + private Builder() { + maybeForceBuilderInitialization(); + } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getEncryptionConfigFieldBuilder(); + } } @java.lang.Override @@ -566,6 +644,11 @@ public Builder clear() { backupId_ = ""; databaseInstanceId_ = ""; databaseId_ = ""; + encryptionConfig_ = null; + if (encryptionConfigBuilder_ != null) { + encryptionConfigBuilder_.dispose(); + encryptionConfigBuilder_ = null; + } return this; } @@ -617,6 +700,13 @@ private void buildPartial0(com.google.spanner.executor.v1.RestoreCloudDatabaseAc if (((from_bitField0_ & 0x00000010) != 0)) { result.databaseId_ = databaseId_; } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000020) != 0)) { + result.encryptionConfig_ = + encryptionConfigBuilder_ == null ? encryptionConfig_ : encryptionConfigBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -690,6 +780,9 @@ public Builder mergeFrom(com.google.spanner.executor.v1.RestoreCloudDatabaseActi bitField0_ |= 0x00000010; onChanged(); } + if (other.hasEncryptionConfig()) { + mergeEncryptionConfig(other.getEncryptionConfig()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -746,6 +839,13 @@ public Builder mergeFrom( bitField0_ |= 0x00000010; break; } // case 42 + case 58: + { + input.readMessage( + getEncryptionConfigFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 58 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1305,6 +1405,206 @@ public Builder setDatabaseIdBytes(com.google.protobuf.ByteString value) { return this; } + private com.google.spanner.admin.database.v1.EncryptionConfig encryptionConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.database.v1.EncryptionConfig, + com.google.spanner.admin.database.v1.EncryptionConfig.Builder, + com.google.spanner.admin.database.v1.EncryptionConfigOrBuilder> + encryptionConfigBuilder_; + /** + * + * + *
+     * The KMS key(s) used to encrypt the restored database to be created if the
+     * restored database should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + * + * @return Whether the encryptionConfig field is set. + */ + public boolean hasEncryptionConfig() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the restored database to be created if the
+     * restored database should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + * + * @return The encryptionConfig. + */ + public com.google.spanner.admin.database.v1.EncryptionConfig getEncryptionConfig() { + if (encryptionConfigBuilder_ == null) { + return encryptionConfig_ == null + ? com.google.spanner.admin.database.v1.EncryptionConfig.getDefaultInstance() + : encryptionConfig_; + } else { + return encryptionConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the restored database to be created if the
+     * restored database should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + public Builder setEncryptionConfig( + com.google.spanner.admin.database.v1.EncryptionConfig value) { + if (encryptionConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + encryptionConfig_ = value; + } else { + encryptionConfigBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the restored database to be created if the
+     * restored database should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + public Builder setEncryptionConfig( + com.google.spanner.admin.database.v1.EncryptionConfig.Builder builderForValue) { + if (encryptionConfigBuilder_ == null) { + encryptionConfig_ = builderForValue.build(); + } else { + encryptionConfigBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the restored database to be created if the
+     * restored database should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + public Builder mergeEncryptionConfig( + com.google.spanner.admin.database.v1.EncryptionConfig value) { + if (encryptionConfigBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) + && encryptionConfig_ != null + && encryptionConfig_ + != com.google.spanner.admin.database.v1.EncryptionConfig.getDefaultInstance()) { + getEncryptionConfigBuilder().mergeFrom(value); + } else { + encryptionConfig_ = value; + } + } else { + encryptionConfigBuilder_.mergeFrom(value); + } + if (encryptionConfig_ != null) { + bitField0_ |= 0x00000020; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the restored database to be created if the
+     * restored database should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + public Builder clearEncryptionConfig() { + bitField0_ = (bitField0_ & ~0x00000020); + encryptionConfig_ = null; + if (encryptionConfigBuilder_ != null) { + encryptionConfigBuilder_.dispose(); + encryptionConfigBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the restored database to be created if the
+     * restored database should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + public com.google.spanner.admin.database.v1.EncryptionConfig.Builder + getEncryptionConfigBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return getEncryptionConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the restored database to be created if the
+     * restored database should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + public com.google.spanner.admin.database.v1.EncryptionConfigOrBuilder + getEncryptionConfigOrBuilder() { + if (encryptionConfigBuilder_ != null) { + return encryptionConfigBuilder_.getMessageOrBuilder(); + } else { + return encryptionConfig_ == null + ? com.google.spanner.admin.database.v1.EncryptionConfig.getDefaultInstance() + : encryptionConfig_; + } + } + /** + * + * + *
+     * The KMS key(s) used to encrypt the restored database to be created if the
+     * restored database should be CMEK protected.
+     * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.database.v1.EncryptionConfig, + com.google.spanner.admin.database.v1.EncryptionConfig.Builder, + com.google.spanner.admin.database.v1.EncryptionConfigOrBuilder> + getEncryptionConfigFieldBuilder() { + if (encryptionConfigBuilder_ == null) { + encryptionConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.database.v1.EncryptionConfig, + com.google.spanner.admin.database.v1.EncryptionConfig.Builder, + com.google.spanner.admin.database.v1.EncryptionConfigOrBuilder>( + getEncryptionConfig(), getParentForChildren(), isClean()); + encryptionConfig_ = null; + } + return encryptionConfigBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/RestoreCloudDatabaseActionOrBuilder.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/RestoreCloudDatabaseActionOrBuilder.java index 478a9aa81f3..7bfa056971a 100644 --- a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/RestoreCloudDatabaseActionOrBuilder.java +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/RestoreCloudDatabaseActionOrBuilder.java @@ -152,4 +152,42 @@ public interface RestoreCloudDatabaseActionOrBuilder * @return The bytes for databaseId. */ com.google.protobuf.ByteString getDatabaseIdBytes(); + + /** + * + * + *
+   * The KMS key(s) used to encrypt the restored database to be created if the
+   * restored database should be CMEK protected.
+   * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + * + * @return Whether the encryptionConfig field is set. + */ + boolean hasEncryptionConfig(); + /** + * + * + *
+   * The KMS key(s) used to encrypt the restored database to be created if the
+   * restored database should be CMEK protected.
+   * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + * + * @return The encryptionConfig. + */ + com.google.spanner.admin.database.v1.EncryptionConfig getEncryptionConfig(); + /** + * + * + *
+   * The KMS key(s) used to encrypt the restored database to be created if the
+   * restored database should be CMEK protected.
+   * 
+ * + * .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; + */ + com.google.spanner.admin.database.v1.EncryptionConfigOrBuilder getEncryptionConfigOrBuilder(); } diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SessionPoolOptions.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SessionPoolOptions.java new file mode 100644 index 00000000000..1e6fbffd393 --- /dev/null +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SessionPoolOptions.java @@ -0,0 +1,539 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/executor/v1/cloud_executor.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.executor.v1; + +/** + * + * + *
+ * Options for the session pool used by the DatabaseClient.
+ * 
+ * + * Protobuf type {@code google.spanner.executor.v1.SessionPoolOptions} + */ +public final class SessionPoolOptions extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.executor.v1.SessionPoolOptions) + SessionPoolOptionsOrBuilder { + private static final long serialVersionUID = 0L; + // Use SessionPoolOptions.newBuilder() to construct. + private SessionPoolOptions(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SessionPoolOptions() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SessionPoolOptions(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.executor.v1.CloudExecutorProto + .internal_static_google_spanner_executor_v1_SessionPoolOptions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.executor.v1.CloudExecutorProto + .internal_static_google_spanner_executor_v1_SessionPoolOptions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.executor.v1.SessionPoolOptions.class, + com.google.spanner.executor.v1.SessionPoolOptions.Builder.class); + } + + public static final int USE_MULTIPLEXED_FIELD_NUMBER = 1; + private boolean useMultiplexed_ = false; + /** + * + * + *
+   * passing this as true, will make applicable RPCs use multiplexed sessions
+   * instead of regular sessions
+   * 
+ * + * bool use_multiplexed = 1; + * + * @return The useMultiplexed. + */ + @java.lang.Override + public boolean getUseMultiplexed() { + return useMultiplexed_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (useMultiplexed_ != false) { + output.writeBool(1, useMultiplexed_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (useMultiplexed_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(1, useMultiplexed_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.executor.v1.SessionPoolOptions)) { + return super.equals(obj); + } + com.google.spanner.executor.v1.SessionPoolOptions other = + (com.google.spanner.executor.v1.SessionPoolOptions) obj; + + if (getUseMultiplexed() != other.getUseMultiplexed()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + USE_MULTIPLEXED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getUseMultiplexed()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.executor.v1.SessionPoolOptions parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.executor.v1.SessionPoolOptions parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.executor.v1.SessionPoolOptions parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.executor.v1.SessionPoolOptions parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.executor.v1.SessionPoolOptions parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.executor.v1.SessionPoolOptions parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.executor.v1.SessionPoolOptions parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.executor.v1.SessionPoolOptions parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.executor.v1.SessionPoolOptions parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.executor.v1.SessionPoolOptions parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.executor.v1.SessionPoolOptions parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.executor.v1.SessionPoolOptions parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.spanner.executor.v1.SessionPoolOptions prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Options for the session pool used by the DatabaseClient.
+   * 
+ * + * Protobuf type {@code google.spanner.executor.v1.SessionPoolOptions} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.executor.v1.SessionPoolOptions) + com.google.spanner.executor.v1.SessionPoolOptionsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.executor.v1.CloudExecutorProto + .internal_static_google_spanner_executor_v1_SessionPoolOptions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.executor.v1.CloudExecutorProto + .internal_static_google_spanner_executor_v1_SessionPoolOptions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.executor.v1.SessionPoolOptions.class, + com.google.spanner.executor.v1.SessionPoolOptions.Builder.class); + } + + // Construct using com.google.spanner.executor.v1.SessionPoolOptions.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + useMultiplexed_ = false; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.executor.v1.CloudExecutorProto + .internal_static_google_spanner_executor_v1_SessionPoolOptions_descriptor; + } + + @java.lang.Override + public com.google.spanner.executor.v1.SessionPoolOptions getDefaultInstanceForType() { + return com.google.spanner.executor.v1.SessionPoolOptions.getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.executor.v1.SessionPoolOptions build() { + com.google.spanner.executor.v1.SessionPoolOptions result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.executor.v1.SessionPoolOptions buildPartial() { + com.google.spanner.executor.v1.SessionPoolOptions result = + new com.google.spanner.executor.v1.SessionPoolOptions(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.spanner.executor.v1.SessionPoolOptions result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.useMultiplexed_ = useMultiplexed_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.executor.v1.SessionPoolOptions) { + return mergeFrom((com.google.spanner.executor.v1.SessionPoolOptions) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.spanner.executor.v1.SessionPoolOptions other) { + if (other == com.google.spanner.executor.v1.SessionPoolOptions.getDefaultInstance()) + return this; + if (other.getUseMultiplexed() != false) { + setUseMultiplexed(other.getUseMultiplexed()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + useMultiplexed_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private boolean useMultiplexed_; + /** + * + * + *
+     * passing this as true, will make applicable RPCs use multiplexed sessions
+     * instead of regular sessions
+     * 
+ * + * bool use_multiplexed = 1; + * + * @return The useMultiplexed. + */ + @java.lang.Override + public boolean getUseMultiplexed() { + return useMultiplexed_; + } + /** + * + * + *
+     * passing this as true, will make applicable RPCs use multiplexed sessions
+     * instead of regular sessions
+     * 
+ * + * bool use_multiplexed = 1; + * + * @param value The useMultiplexed to set. + * @return This builder for chaining. + */ + public Builder setUseMultiplexed(boolean value) { + + useMultiplexed_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * passing this as true, will make applicable RPCs use multiplexed sessions
+     * instead of regular sessions
+     * 
+ * + * bool use_multiplexed = 1; + * + * @return This builder for chaining. + */ + public Builder clearUseMultiplexed() { + bitField0_ = (bitField0_ & ~0x00000001); + useMultiplexed_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.executor.v1.SessionPoolOptions) + } + + // @@protoc_insertion_point(class_scope:google.spanner.executor.v1.SessionPoolOptions) + private static final com.google.spanner.executor.v1.SessionPoolOptions DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.executor.v1.SessionPoolOptions(); + } + + public static com.google.spanner.executor.v1.SessionPoolOptions getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SessionPoolOptions parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.executor.v1.SessionPoolOptions getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SessionPoolOptionsOrBuilder.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SessionPoolOptionsOrBuilder.java new file mode 100644 index 00000000000..b9d4f00a03f --- /dev/null +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SessionPoolOptionsOrBuilder.java @@ -0,0 +1,40 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/executor/v1/cloud_executor.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.executor.v1; + +public interface SessionPoolOptionsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.executor.v1.SessionPoolOptions) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * passing this as true, will make applicable RPCs use multiplexed sessions
+   * instead of regular sessions
+   * 
+ * + * bool use_multiplexed = 1; + * + * @return The useMultiplexed. + */ + boolean getUseMultiplexed(); +} diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerAction.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerAction.java index f98b6eb2f35..45af616c4e7 100644 --- a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerAction.java +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerAction.java @@ -65,6 +65,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.spanner.executor.v1.SpannerAction.Builder.class); } + private int bitField0_; private int actionCase_ = 0; @SuppressWarnings("serial") @@ -211,6 +212,56 @@ public com.google.protobuf.ByteString getDatabasePathBytes() { } } + public static final int SPANNER_OPTIONS_FIELD_NUMBER = 2; + private com.google.spanner.executor.v1.SpannerOptions spannerOptions_; + /** + * + * + *
+   * Configuration options for Spanner backend
+   * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + * + * @return Whether the spannerOptions field is set. + */ + @java.lang.Override + public boolean hasSpannerOptions() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Configuration options for Spanner backend
+   * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + * + * @return The spannerOptions. + */ + @java.lang.Override + public com.google.spanner.executor.v1.SpannerOptions getSpannerOptions() { + return spannerOptions_ == null + ? com.google.spanner.executor.v1.SpannerOptions.getDefaultInstance() + : spannerOptions_; + } + /** + * + * + *
+   * Configuration options for Spanner backend
+   * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + */ + @java.lang.Override + public com.google.spanner.executor.v1.SpannerOptionsOrBuilder getSpannerOptionsOrBuilder() { + return spannerOptions_ == null + ? com.google.spanner.executor.v1.SpannerOptions.getDefaultInstance() + : spannerOptions_; + } + public static final int START_FIELD_NUMBER = 10; /** * @@ -1071,6 +1122,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(databasePath_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, databasePath_); } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getSpannerOptions()); + } if (actionCase_ == 10) { output.writeMessage(10, (com.google.spanner.executor.v1.StartTransactionAction) action_); } @@ -1133,6 +1187,9 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(databasePath_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, databasePath_); } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getSpannerOptions()); + } if (actionCase_ == 10) { size += com.google.protobuf.CodedOutputStream.computeMessageSize( @@ -1230,6 +1287,10 @@ public boolean equals(final java.lang.Object obj) { (com.google.spanner.executor.v1.SpannerAction) obj; if (!getDatabasePath().equals(other.getDatabasePath())) return false; + if (hasSpannerOptions() != other.hasSpannerOptions()) return false; + if (hasSpannerOptions()) { + if (!getSpannerOptions().equals(other.getSpannerOptions())) return false; + } if (!getActionCase().equals(other.getActionCase())) return false; switch (actionCase_) { case 10: @@ -1299,6 +1360,10 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + DATABASE_PATH_FIELD_NUMBER; hash = (53 * hash) + getDatabasePath().hashCode(); + if (hasSpannerOptions()) { + hash = (37 * hash) + SPANNER_OPTIONS_FIELD_NUMBER; + hash = (53 * hash) + getSpannerOptions().hashCode(); + } switch (actionCase_) { case 10: hash = (37 * hash) + START_FIELD_NUMBER; @@ -1498,10 +1563,19 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { } // Construct using com.google.spanner.executor.v1.SpannerAction.newBuilder() - private Builder() {} + private Builder() { + maybeForceBuilderInitialization(); + } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getSpannerOptionsFieldBuilder(); + } } @java.lang.Override @@ -1509,6 +1583,11 @@ public Builder clear() { super.clear(); bitField0_ = 0; databasePath_ = ""; + spannerOptions_ = null; + if (spannerOptionsBuilder_ != null) { + spannerOptionsBuilder_.dispose(); + spannerOptionsBuilder_ = null; + } if (startBuilder_ != null) { startBuilder_.clear(); } @@ -1599,6 +1678,13 @@ private void buildPartial0(com.google.spanner.executor.v1.SpannerAction result) if (((from_bitField0_ & 0x00000001) != 0)) { result.databasePath_ = databasePath_; } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.spannerOptions_ = + spannerOptionsBuilder_ == null ? spannerOptions_ : spannerOptionsBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; } private void buildPartialOneofs(com.google.spanner.executor.v1.SpannerAction result) { @@ -1704,6 +1790,9 @@ public Builder mergeFrom(com.google.spanner.executor.v1.SpannerAction other) { bitField0_ |= 0x00000001; onChanged(); } + if (other.hasSpannerOptions()) { + mergeSpannerOptions(other.getSpannerOptions()); + } switch (other.getActionCase()) { case START: { @@ -1822,6 +1911,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000001; break; } // case 10 + case 18: + { + input.readMessage(getSpannerOptionsFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 case 82: { input.readMessage(getStartFieldBuilder().getBuilder(), extensionRegistry); @@ -2072,6 +2167,193 @@ public Builder setDatabasePathBytes(com.google.protobuf.ByteString value) { return this; } + private com.google.spanner.executor.v1.SpannerOptions spannerOptions_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.executor.v1.SpannerOptions, + com.google.spanner.executor.v1.SpannerOptions.Builder, + com.google.spanner.executor.v1.SpannerOptionsOrBuilder> + spannerOptionsBuilder_; + /** + * + * + *
+     * Configuration options for Spanner backend
+     * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + * + * @return Whether the spannerOptions field is set. + */ + public boolean hasSpannerOptions() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Configuration options for Spanner backend
+     * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + * + * @return The spannerOptions. + */ + public com.google.spanner.executor.v1.SpannerOptions getSpannerOptions() { + if (spannerOptionsBuilder_ == null) { + return spannerOptions_ == null + ? com.google.spanner.executor.v1.SpannerOptions.getDefaultInstance() + : spannerOptions_; + } else { + return spannerOptionsBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Configuration options for Spanner backend
+     * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + */ + public Builder setSpannerOptions(com.google.spanner.executor.v1.SpannerOptions value) { + if (spannerOptionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + spannerOptions_ = value; + } else { + spannerOptionsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Configuration options for Spanner backend
+     * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + */ + public Builder setSpannerOptions( + com.google.spanner.executor.v1.SpannerOptions.Builder builderForValue) { + if (spannerOptionsBuilder_ == null) { + spannerOptions_ = builderForValue.build(); + } else { + spannerOptionsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Configuration options for Spanner backend
+     * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + */ + public Builder mergeSpannerOptions(com.google.spanner.executor.v1.SpannerOptions value) { + if (spannerOptionsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && spannerOptions_ != null + && spannerOptions_ + != com.google.spanner.executor.v1.SpannerOptions.getDefaultInstance()) { + getSpannerOptionsBuilder().mergeFrom(value); + } else { + spannerOptions_ = value; + } + } else { + spannerOptionsBuilder_.mergeFrom(value); + } + if (spannerOptions_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Configuration options for Spanner backend
+     * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + */ + public Builder clearSpannerOptions() { + bitField0_ = (bitField0_ & ~0x00000002); + spannerOptions_ = null; + if (spannerOptionsBuilder_ != null) { + spannerOptionsBuilder_.dispose(); + spannerOptionsBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Configuration options for Spanner backend
+     * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + */ + public com.google.spanner.executor.v1.SpannerOptions.Builder getSpannerOptionsBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getSpannerOptionsFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Configuration options for Spanner backend
+     * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + */ + public com.google.spanner.executor.v1.SpannerOptionsOrBuilder getSpannerOptionsOrBuilder() { + if (spannerOptionsBuilder_ != null) { + return spannerOptionsBuilder_.getMessageOrBuilder(); + } else { + return spannerOptions_ == null + ? com.google.spanner.executor.v1.SpannerOptions.getDefaultInstance() + : spannerOptions_; + } + } + /** + * + * + *
+     * Configuration options for Spanner backend
+     * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.executor.v1.SpannerOptions, + com.google.spanner.executor.v1.SpannerOptions.Builder, + com.google.spanner.executor.v1.SpannerOptionsOrBuilder> + getSpannerOptionsFieldBuilder() { + if (spannerOptionsBuilder_ == null) { + spannerOptionsBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.executor.v1.SpannerOptions, + com.google.spanner.executor.v1.SpannerOptions.Builder, + com.google.spanner.executor.v1.SpannerOptionsOrBuilder>( + getSpannerOptions(), getParentForChildren(), isClean()); + spannerOptions_ = null; + } + return spannerOptionsBuilder_; + } + private com.google.protobuf.SingleFieldBuilderV3< com.google.spanner.executor.v1.StartTransactionAction, com.google.spanner.executor.v1.StartTransactionAction.Builder, diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerActionOrBuilder.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerActionOrBuilder.java index 32aaf468a27..61e481d8036 100644 --- a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerActionOrBuilder.java +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerActionOrBuilder.java @@ -53,6 +53,41 @@ public interface SpannerActionOrBuilder */ com.google.protobuf.ByteString getDatabasePathBytes(); + /** + * + * + *
+   * Configuration options for Spanner backend
+   * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + * + * @return Whether the spannerOptions field is set. + */ + boolean hasSpannerOptions(); + /** + * + * + *
+   * Configuration options for Spanner backend
+   * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + * + * @return The spannerOptions. + */ + com.google.spanner.executor.v1.SpannerOptions getSpannerOptions(); + /** + * + * + *
+   * Configuration options for Spanner backend
+   * 
+ * + * .google.spanner.executor.v1.SpannerOptions spanner_options = 2; + */ + com.google.spanner.executor.v1.SpannerOptionsOrBuilder getSpannerOptionsOrBuilder(); + /** * * diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerOptions.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerOptions.java new file mode 100644 index 00000000000..1ff00f038f0 --- /dev/null +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerOptions.java @@ -0,0 +1,730 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/executor/v1/cloud_executor.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.executor.v1; + +/** + * + * + *
+ * Options for Cloud Spanner Service.
+ * 
+ * + * Protobuf type {@code google.spanner.executor.v1.SpannerOptions} + */ +public final class SpannerOptions extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.executor.v1.SpannerOptions) + SpannerOptionsOrBuilder { + private static final long serialVersionUID = 0L; + // Use SpannerOptions.newBuilder() to construct. + private SpannerOptions(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SpannerOptions() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SpannerOptions(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.executor.v1.CloudExecutorProto + .internal_static_google_spanner_executor_v1_SpannerOptions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.executor.v1.CloudExecutorProto + .internal_static_google_spanner_executor_v1_SpannerOptions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.executor.v1.SpannerOptions.class, + com.google.spanner.executor.v1.SpannerOptions.Builder.class); + } + + private int bitField0_; + public static final int SESSION_POOL_OPTIONS_FIELD_NUMBER = 1; + private com.google.spanner.executor.v1.SessionPoolOptions sessionPoolOptions_; + /** + * + * + *
+   * Options for configuring the session pool
+   * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + * + * @return Whether the sessionPoolOptions field is set. + */ + @java.lang.Override + public boolean hasSessionPoolOptions() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Options for configuring the session pool
+   * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + * + * @return The sessionPoolOptions. + */ + @java.lang.Override + public com.google.spanner.executor.v1.SessionPoolOptions getSessionPoolOptions() { + return sessionPoolOptions_ == null + ? com.google.spanner.executor.v1.SessionPoolOptions.getDefaultInstance() + : sessionPoolOptions_; + } + /** + * + * + *
+   * Options for configuring the session pool
+   * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + */ + @java.lang.Override + public com.google.spanner.executor.v1.SessionPoolOptionsOrBuilder + getSessionPoolOptionsOrBuilder() { + return sessionPoolOptions_ == null + ? com.google.spanner.executor.v1.SessionPoolOptions.getDefaultInstance() + : sessionPoolOptions_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getSessionPoolOptions()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getSessionPoolOptions()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.executor.v1.SpannerOptions)) { + return super.equals(obj); + } + com.google.spanner.executor.v1.SpannerOptions other = + (com.google.spanner.executor.v1.SpannerOptions) obj; + + if (hasSessionPoolOptions() != other.hasSessionPoolOptions()) return false; + if (hasSessionPoolOptions()) { + if (!getSessionPoolOptions().equals(other.getSessionPoolOptions())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasSessionPoolOptions()) { + hash = (37 * hash) + SESSION_POOL_OPTIONS_FIELD_NUMBER; + hash = (53 * hash) + getSessionPoolOptions().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.executor.v1.SpannerOptions parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.executor.v1.SpannerOptions parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.executor.v1.SpannerOptions parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.executor.v1.SpannerOptions parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.executor.v1.SpannerOptions parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.executor.v1.SpannerOptions parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.executor.v1.SpannerOptions parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.executor.v1.SpannerOptions parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.executor.v1.SpannerOptions parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.executor.v1.SpannerOptions parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.executor.v1.SpannerOptions parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.executor.v1.SpannerOptions parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.spanner.executor.v1.SpannerOptions prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Options for Cloud Spanner Service.
+   * 
+ * + * Protobuf type {@code google.spanner.executor.v1.SpannerOptions} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.executor.v1.SpannerOptions) + com.google.spanner.executor.v1.SpannerOptionsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.executor.v1.CloudExecutorProto + .internal_static_google_spanner_executor_v1_SpannerOptions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.executor.v1.CloudExecutorProto + .internal_static_google_spanner_executor_v1_SpannerOptions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.executor.v1.SpannerOptions.class, + com.google.spanner.executor.v1.SpannerOptions.Builder.class); + } + + // Construct using com.google.spanner.executor.v1.SpannerOptions.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getSessionPoolOptionsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + sessionPoolOptions_ = null; + if (sessionPoolOptionsBuilder_ != null) { + sessionPoolOptionsBuilder_.dispose(); + sessionPoolOptionsBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.executor.v1.CloudExecutorProto + .internal_static_google_spanner_executor_v1_SpannerOptions_descriptor; + } + + @java.lang.Override + public com.google.spanner.executor.v1.SpannerOptions getDefaultInstanceForType() { + return com.google.spanner.executor.v1.SpannerOptions.getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.executor.v1.SpannerOptions build() { + com.google.spanner.executor.v1.SpannerOptions result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.executor.v1.SpannerOptions buildPartial() { + com.google.spanner.executor.v1.SpannerOptions result = + new com.google.spanner.executor.v1.SpannerOptions(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.spanner.executor.v1.SpannerOptions result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.sessionPoolOptions_ = + sessionPoolOptionsBuilder_ == null + ? sessionPoolOptions_ + : sessionPoolOptionsBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.executor.v1.SpannerOptions) { + return mergeFrom((com.google.spanner.executor.v1.SpannerOptions) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.spanner.executor.v1.SpannerOptions other) { + if (other == com.google.spanner.executor.v1.SpannerOptions.getDefaultInstance()) return this; + if (other.hasSessionPoolOptions()) { + mergeSessionPoolOptions(other.getSessionPoolOptions()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + getSessionPoolOptionsFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.spanner.executor.v1.SessionPoolOptions sessionPoolOptions_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.executor.v1.SessionPoolOptions, + com.google.spanner.executor.v1.SessionPoolOptions.Builder, + com.google.spanner.executor.v1.SessionPoolOptionsOrBuilder> + sessionPoolOptionsBuilder_; + /** + * + * + *
+     * Options for configuring the session pool
+     * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + * + * @return Whether the sessionPoolOptions field is set. + */ + public boolean hasSessionPoolOptions() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * Options for configuring the session pool
+     * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + * + * @return The sessionPoolOptions. + */ + public com.google.spanner.executor.v1.SessionPoolOptions getSessionPoolOptions() { + if (sessionPoolOptionsBuilder_ == null) { + return sessionPoolOptions_ == null + ? com.google.spanner.executor.v1.SessionPoolOptions.getDefaultInstance() + : sessionPoolOptions_; + } else { + return sessionPoolOptionsBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Options for configuring the session pool
+     * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + */ + public Builder setSessionPoolOptions(com.google.spanner.executor.v1.SessionPoolOptions value) { + if (sessionPoolOptionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + sessionPoolOptions_ = value; + } else { + sessionPoolOptionsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Options for configuring the session pool
+     * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + */ + public Builder setSessionPoolOptions( + com.google.spanner.executor.v1.SessionPoolOptions.Builder builderForValue) { + if (sessionPoolOptionsBuilder_ == null) { + sessionPoolOptions_ = builderForValue.build(); + } else { + sessionPoolOptionsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Options for configuring the session pool
+     * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + */ + public Builder mergeSessionPoolOptions( + com.google.spanner.executor.v1.SessionPoolOptions value) { + if (sessionPoolOptionsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && sessionPoolOptions_ != null + && sessionPoolOptions_ + != com.google.spanner.executor.v1.SessionPoolOptions.getDefaultInstance()) { + getSessionPoolOptionsBuilder().mergeFrom(value); + } else { + sessionPoolOptions_ = value; + } + } else { + sessionPoolOptionsBuilder_.mergeFrom(value); + } + if (sessionPoolOptions_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Options for configuring the session pool
+     * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + */ + public Builder clearSessionPoolOptions() { + bitField0_ = (bitField0_ & ~0x00000001); + sessionPoolOptions_ = null; + if (sessionPoolOptionsBuilder_ != null) { + sessionPoolOptionsBuilder_.dispose(); + sessionPoolOptionsBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Options for configuring the session pool
+     * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + */ + public com.google.spanner.executor.v1.SessionPoolOptions.Builder + getSessionPoolOptionsBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getSessionPoolOptionsFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Options for configuring the session pool
+     * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + */ + public com.google.spanner.executor.v1.SessionPoolOptionsOrBuilder + getSessionPoolOptionsOrBuilder() { + if (sessionPoolOptionsBuilder_ != null) { + return sessionPoolOptionsBuilder_.getMessageOrBuilder(); + } else { + return sessionPoolOptions_ == null + ? com.google.spanner.executor.v1.SessionPoolOptions.getDefaultInstance() + : sessionPoolOptions_; + } + } + /** + * + * + *
+     * Options for configuring the session pool
+     * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.executor.v1.SessionPoolOptions, + com.google.spanner.executor.v1.SessionPoolOptions.Builder, + com.google.spanner.executor.v1.SessionPoolOptionsOrBuilder> + getSessionPoolOptionsFieldBuilder() { + if (sessionPoolOptionsBuilder_ == null) { + sessionPoolOptionsBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.executor.v1.SessionPoolOptions, + com.google.spanner.executor.v1.SessionPoolOptions.Builder, + com.google.spanner.executor.v1.SessionPoolOptionsOrBuilder>( + getSessionPoolOptions(), getParentForChildren(), isClean()); + sessionPoolOptions_ = null; + } + return sessionPoolOptionsBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.executor.v1.SpannerOptions) + } + + // @@protoc_insertion_point(class_scope:google.spanner.executor.v1.SpannerOptions) + private static final com.google.spanner.executor.v1.SpannerOptions DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.executor.v1.SpannerOptions(); + } + + public static com.google.spanner.executor.v1.SpannerOptions getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SpannerOptions parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.executor.v1.SpannerOptions getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerOptionsOrBuilder.java b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerOptionsOrBuilder.java new file mode 100644 index 00000000000..39d05d1b247 --- /dev/null +++ b/proto-google-cloud-spanner-executor-v1/src/main/java/com/google/spanner/executor/v1/SpannerOptionsOrBuilder.java @@ -0,0 +1,61 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/executor/v1/cloud_executor.proto + +// Protobuf Java Version: 3.25.2 +package com.google.spanner.executor.v1; + +public interface SpannerOptionsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.executor.v1.SpannerOptions) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Options for configuring the session pool
+   * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + * + * @return Whether the sessionPoolOptions field is set. + */ + boolean hasSessionPoolOptions(); + /** + * + * + *
+   * Options for configuring the session pool
+   * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + * + * @return The sessionPoolOptions. + */ + com.google.spanner.executor.v1.SessionPoolOptions getSessionPoolOptions(); + /** + * + * + *
+   * Options for configuring the session pool
+   * 
+ * + * .google.spanner.executor.v1.SessionPoolOptions session_pool_options = 1; + */ + com.google.spanner.executor.v1.SessionPoolOptionsOrBuilder getSessionPoolOptionsOrBuilder(); +} diff --git a/proto-google-cloud-spanner-executor-v1/src/main/proto/google/spanner/executor/v1/cloud_executor.proto b/proto-google-cloud-spanner-executor-v1/src/main/proto/google/spanner/executor/v1/cloud_executor.proto index 56332dc0e8d..3ad36e3ee30 100644 --- a/proto-google-cloud-spanner-executor-v1/src/main/proto/google/spanner/executor/v1/cloud_executor.proto +++ b/proto-google-cloud-spanner-executor-v1/src/main/proto/google/spanner/executor/v1/cloud_executor.proto @@ -78,6 +78,9 @@ message SpannerAction { // database path if it applies to the same database as the previous action. string database_path = 1; + // Configuration options for Spanner backend + SpannerOptions spanner_options = 2; + // Action represents a spanner action kind, there will only be one action kind // per SpannerAction. oneof action { @@ -565,8 +568,8 @@ message AdminAction { // Action that cancels an operation. CancelOperationAction cancel_operation = 26; - // Action that reconfigures a Cloud Spanner database. - ReconfigureCloudDatabaseAction reconfigure_cloud_database = 28; + // Action that changes quorum of a Cloud Spanner database. + ChangeQuorumCloudDatabaseAction change_quorum_cloud_database = 28; } } @@ -772,9 +775,9 @@ message DropCloudDatabaseAction { string database_id = 3; } -// Action that reconfigures a Cloud Spanner database. -message ReconfigureCloudDatabaseAction { - // The fully qualified uri of the database to be reconfigured. +// Action that changes quorum of a Cloud Spanner database. +message ChangeQuorumCloudDatabaseAction { + // The fully qualified uri of the database whose quorum has to be changed. optional string database_uri = 1; // The locations of the serving regions, e.g. "asia-south1". @@ -877,6 +880,10 @@ message RestoreCloudDatabaseAction { // The id of the database to create and restore to, e.g. "db0". Note that this // database must not already exist. string database_id = 5; + + // The KMS key(s) used to encrypt the restored database to be created if the + // restored database should be CMEK protected. + google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; } // Action that gets a Cloud Spanner database. @@ -916,6 +923,10 @@ message CreateCloudBackupAction { // [earliest_version_time, NOW], where earliest_version_time is retrieved by // cloud spanner frontend API (See details: go/cs-pitr-lite-design). optional google.protobuf.Timestamp version_time = 6; + + // The KMS key(s) used to encrypt the backup to be created if the backup + // should be CMEK protected. + google.spanner.admin.database.v1.EncryptionConfig encryption_config = 7; } // Action that copies a Cloud Spanner database backup. @@ -1481,3 +1492,16 @@ message HeartbeatRecord { // Timestamp for this heartbeat check. google.protobuf.Timestamp heartbeat_time = 1; } + +// Options for Cloud Spanner Service. +message SpannerOptions { + // Options for configuring the session pool + SessionPoolOptions session_pool_options = 1; +} + +// Options for the session pool used by the DatabaseClient. +message SessionPoolOptions { + // passing this as true, will make applicable RPCs use multiplexed sessions + // instead of regular sessions + bool use_multiplexed = 1; +} From b63740dccc94d7349215176403f9bcc42183071f Mon Sep 17 00:00:00 2001 From: Quynh Tran Date: Fri, 5 Apr 2024 10:32:21 +1100 Subject: [PATCH 47/47] chore: Remove unused CLIRR entries --- google-cloud-spanner/clirr-ignored-differences.xml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/google-cloud-spanner/clirr-ignored-differences.xml b/google-cloud-spanner/clirr-ignored-differences.xml index 1342e771bfa..4b10a3bf2c9 100644 --- a/google-cloud-spanner/clirr-ignored-differences.xml +++ b/google-cloud-spanner/clirr-ignored-differences.xml @@ -192,18 +192,6 @@ com/google/cloud/spanner/StructReader java.util.List getPgJsonbList(java.lang.String)
- - - 7013 - com/google/cloud/spanner/Value - long getPgOid() - - - 7013 - com/google/cloud/spanner/Value - java.util.List getPgOidArray() - - 7012 com/google/cloud/spanner/StructReader