diff --git a/google-cloud-bigquerystorage/clirr-ignored-differences.xml b/google-cloud-bigquerystorage/clirr-ignored-differences.xml index edc5073600..89bad8b88c 100644 --- a/google-cloud-bigquerystorage/clirr-ignored-differences.xml +++ b/google-cloud-bigquerystorage/clirr-ignored-differences.xml @@ -31,4 +31,4 @@ com/google/cloud/bigquery/storage/v1beta2/JsonStreamWriter$Builder com.google.cloud.bigquery.storage.v1beta2.JsonStreamWriter$Builder createDefaultStream() - \ No newline at end of file + diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/BaseBigQueryReadSettings.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/BaseBigQueryReadSettings.java index bc80bd6c66..33210bca04 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/BaseBigQueryReadSettings.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/BaseBigQueryReadSettings.java @@ -169,14 +169,13 @@ public BigQueryReadStubSettings.Builder getStubSettingsBuilder() { return ((BigQueryReadStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods( getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); return this; diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/stub/BigQueryReadStubSettings.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/stub/BigQueryReadStubSettings.java index 6a597a92db..50d368c74f 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/stub/BigQueryReadStubSettings.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/stub/BigQueryReadStubSettings.java @@ -323,14 +323,13 @@ private static Builder initDefaults(Builder builder) { return builder; } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; } diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/stub/GrpcBigQueryReadStub.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/stub/GrpcBigQueryReadStub.java index 254997c867..660466cec7 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/stub/GrpcBigQueryReadStub.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/stub/GrpcBigQueryReadStub.java @@ -21,7 +21,6 @@ import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.RequestParamsExtractor; import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.bigquery.storage.v1.CreateReadSessionRequest; @@ -35,7 +34,6 @@ import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; -import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -128,27 +126,21 @@ protected GrpcBigQueryReadStub( GrpcCallSettings.newBuilder() .setMethodDescriptor(createReadSessionMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(CreateReadSessionRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put( - "read_session.table", String.valueOf(request.getReadSession().getTable())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "read_session.table", String.valueOf(request.getReadSession().getTable())); + return params.build(); }) .build(); GrpcCallSettings readRowsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(readRowsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ReadRowsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("read_stream", String.valueOf(request.getReadStream())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("read_stream", String.valueOf(request.getReadStream())); + return params.build(); }) .build(); GrpcCallSettings @@ -156,13 +148,10 @@ public Map extract(ReadRowsRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(splitReadStreamMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(SplitReadStreamRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); @@ -203,7 +192,13 @@ public UnaryCallable splitReadS @Override public final void close() { - shutdown(); + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } } @Override diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/BaseBigQueryStorageSettings.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/BaseBigQueryStorageSettings.java index 06a7a6a60e..071d5b03cb 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/BaseBigQueryStorageSettings.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/BaseBigQueryStorageSettings.java @@ -188,14 +188,13 @@ public BigQueryStorageStubSettings.Builder getStubSettingsBuilder() { return ((BigQueryStorageStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods( getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); return this; diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/stub/BigQueryStorageStubSettings.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/stub/BigQueryStorageStubSettings.java index d0e8825f6a..67bd4b0659 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/stub/BigQueryStorageStubSettings.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/stub/BigQueryStorageStubSettings.java @@ -375,14 +375,13 @@ private static Builder initDefaults(Builder builder) { return builder; } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; } diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/stub/GrpcBigQueryStorageStub.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/stub/GrpcBigQueryStorageStub.java index a7e2009269..02ddff2b0b 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/stub/GrpcBigQueryStorageStub.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta1/stub/GrpcBigQueryStorageStub.java @@ -22,7 +22,6 @@ import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.RequestParamsExtractor; import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.bigquery.storage.v1beta1.Storage; @@ -32,7 +31,6 @@ import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; -import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -173,33 +171,27 @@ protected GrpcBigQueryStorageStub( GrpcCallSettings.newBuilder() .setMethodDescriptor(createReadSessionMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(Storage.CreateReadSessionRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put( - "table_reference.dataset_id", - String.valueOf(request.getTableReference().getDatasetId())); - params.put( - "table_reference.project_id", - String.valueOf(request.getTableReference().getProjectId())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "table_reference.dataset_id", + String.valueOf(request.getTableReference().getDatasetId())); + params.put( + "table_reference.project_id", + String.valueOf(request.getTableReference().getProjectId())); + return params.build(); }) .build(); GrpcCallSettings readRowsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(readRowsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(Storage.ReadRowsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put( - "read_position.stream.name", - String.valueOf(request.getReadPosition().getStream().getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "read_position.stream.name", + String.valueOf(request.getReadPosition().getStream().getName())); + return params.build(); }) .build(); GrpcCallSettings< @@ -212,27 +204,20 @@ public Map extract(Storage.ReadRowsRequest request) { newBuilder() .setMethodDescriptor(batchCreateReadSessionStreamsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract( - Storage.BatchCreateReadSessionStreamsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("session.name", String.valueOf(request.getSession().getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("session.name", String.valueOf(request.getSession().getName())); + return params.build(); }) .build(); GrpcCallSettings finalizeStreamTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(finalizeStreamMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(Storage.FinalizeStreamRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("stream.name", String.valueOf(request.getStream().getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("stream.name", String.valueOf(request.getStream().getName())); + return params.build(); }) .build(); GrpcCallSettings @@ -241,15 +226,12 @@ public Map extract(Storage.FinalizeStreamRequest request) { .newBuilder() .setMethodDescriptor(splitReadStreamMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(Storage.SplitReadStreamRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put( - "original_stream.name", - String.valueOf(request.getOriginalStream().getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "original_stream.name", + String.valueOf(request.getOriginalStream().getName())); + return params.build(); }) .build(); @@ -314,7 +296,13 @@ public UnaryCallable finalizeStreamCallabl @Override public final void close() { - shutdown(); + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } } @Override diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/BaseBigQueryReadSettings.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/BaseBigQueryReadSettings.java index 3371fd3854..ff849fda07 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/BaseBigQueryReadSettings.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/BaseBigQueryReadSettings.java @@ -170,14 +170,13 @@ public BigQueryReadStubSettings.Builder getStubSettingsBuilder() { return ((BigQueryReadStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods( getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); return this; diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/BigQueryWriteSettings.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/BigQueryWriteSettings.java index 071973e642..d7ac9efa69 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/BigQueryWriteSettings.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/BigQueryWriteSettings.java @@ -185,14 +185,13 @@ public BigQueryWriteStubSettings.Builder getStubSettingsBuilder() { return ((BigQueryWriteStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods( getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); return this; diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/BigQueryReadStubSettings.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/BigQueryReadStubSettings.java index af3f152002..70818e9860 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/BigQueryReadStubSettings.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/BigQueryReadStubSettings.java @@ -324,14 +324,13 @@ private static Builder initDefaults(Builder builder) { return builder; } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; } diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/BigQueryWriteStubSettings.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/BigQueryWriteStubSettings.java index 6becb16121..bb5c448f69 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/BigQueryWriteStubSettings.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/BigQueryWriteStubSettings.java @@ -386,14 +386,13 @@ private static Builder initDefaults(Builder builder) { return builder; } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; } diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/GrpcBigQueryReadStub.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/GrpcBigQueryReadStub.java index 8947c2a8d7..0fd09d68e5 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/GrpcBigQueryReadStub.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/GrpcBigQueryReadStub.java @@ -22,7 +22,6 @@ import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.RequestParamsExtractor; import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.bigquery.storage.v1beta2.CreateReadSessionRequest; @@ -36,7 +35,6 @@ import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; -import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -132,27 +130,21 @@ protected GrpcBigQueryReadStub( GrpcCallSettings.newBuilder() .setMethodDescriptor(createReadSessionMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(CreateReadSessionRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put( - "read_session.table", String.valueOf(request.getReadSession().getTable())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "read_session.table", String.valueOf(request.getReadSession().getTable())); + return params.build(); }) .build(); GrpcCallSettings readRowsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(readRowsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ReadRowsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("read_stream", String.valueOf(request.getReadStream())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("read_stream", String.valueOf(request.getReadStream())); + return params.build(); }) .build(); GrpcCallSettings @@ -160,13 +152,10 @@ public Map extract(ReadRowsRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(splitReadStreamMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(SplitReadStreamRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); @@ -207,7 +196,13 @@ public UnaryCallable splitReadS @Override public final void close() { - shutdown(); + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } } @Override diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/GrpcBigQueryWriteStub.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/GrpcBigQueryWriteStub.java index 3d7ca9d2cf..e57bc79573 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/GrpcBigQueryWriteStub.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/stub/GrpcBigQueryWriteStub.java @@ -23,7 +23,6 @@ import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.RequestParamsExtractor; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest; import com.google.cloud.bigquery.storage.v1beta2.AppendRowsResponse; @@ -41,7 +40,6 @@ import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; -import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -175,39 +173,30 @@ protected GrpcBigQueryWriteStub( GrpcCallSettings.newBuilder() .setMethodDescriptor(createWriteStreamMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(CreateWriteStreamRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings appendRowsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(appendRowsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(AppendRowsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("write_stream", String.valueOf(request.getWriteStream())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("write_stream", String.valueOf(request.getWriteStream())); + return params.build(); }) .build(); GrpcCallSettings getWriteStreamTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getWriteStreamMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetWriteStreamRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings @@ -215,13 +204,10 @@ public Map extract(GetWriteStreamRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(finalizeWriteStreamMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(FinalizeWriteStreamRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings @@ -230,26 +216,20 @@ public Map extract(FinalizeWriteStreamRequest request) { .newBuilder() .setMethodDescriptor(batchCommitWriteStreamsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(BatchCommitWriteStreamsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings flushRowsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(flushRowsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(FlushRowsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("write_stream", String.valueOf(request.getWriteStream())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("write_stream", String.valueOf(request.getWriteStream())); + return params.build(); }) .build(); @@ -320,7 +300,13 @@ public UnaryCallable flushRowsCallable() { @Override public final void close() { - shutdown(); + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } } @Override diff --git a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/BaseBigQueryReadClientTest.java b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/BaseBigQueryReadClientTest.java index 9116265c5e..0a668e4372 100644 --- a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/BaseBigQueryReadClientTest.java +++ b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/BaseBigQueryReadClientTest.java @@ -85,10 +85,10 @@ public void tearDown() throws Exception { public void createReadSessionTest() throws Exception { ReadSession expectedResponse = ReadSession.newBuilder() - .setName(ReadSessionName.of("[PROJECT]", "[LOCATION]", "[SESSION]").toString()) + .setName("name3373707") .setExpireTime(Timestamp.newBuilder().build()) .setDataFormat(DataFormat.forNumber(0)) - .setTable(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString()) + .setTable("table110115790") .setTableModifiers(ReadSession.TableModifiers.newBuilder().build()) .setReadOptions(ReadSession.TableReadOptions.newBuilder().build()) .addAllStreams(new ArrayList()) @@ -135,10 +135,10 @@ public void createReadSessionExceptionTest() throws Exception { public void createReadSessionTest2() throws Exception { ReadSession expectedResponse = ReadSession.newBuilder() - .setName(ReadSessionName.of("[PROJECT]", "[LOCATION]", "[SESSION]").toString()) + .setName("name3373707") .setExpireTime(Timestamp.newBuilder().build()) .setDataFormat(DataFormat.forNumber(0)) - .setTable(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString()) + .setTable("table110115790") .setTableModifiers(ReadSession.TableModifiers.newBuilder().build()) .setReadOptions(ReadSession.TableReadOptions.newBuilder().build()) .addAllStreams(new ArrayList()) diff --git a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta1/BaseBigQueryStorageClientTest.java b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta1/BaseBigQueryStorageClientTest.java index fc7851aad9..b008fc3b5b 100644 --- a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta1/BaseBigQueryStorageClientTest.java +++ b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta1/BaseBigQueryStorageClientTest.java @@ -86,7 +86,7 @@ public void tearDown() throws Exception { public void createReadSessionTest() throws Exception { Storage.ReadSession expectedResponse = Storage.ReadSession.newBuilder() - .setName(ReadSessionName.of("[PROJECT]", "[LOCATION]", "[SESSION]").toString()) + .setName("name3373707") .setExpireTime(Timestamp.newBuilder().build()) .addAllStreams(new ArrayList()) .setTableReference(TableReferenceProto.TableReference.newBuilder().build()) @@ -139,7 +139,7 @@ public void createReadSessionExceptionTest() throws Exception { public void createReadSessionTest2() throws Exception { Storage.ReadSession expectedResponse = Storage.ReadSession.newBuilder() - .setName(ReadSessionName.of("[PROJECT]", "[LOCATION]", "[SESSION]").toString()) + .setName("name3373707") .setExpireTime(Timestamp.newBuilder().build()) .addAllStreams(new ArrayList()) .setTableReference(TableReferenceProto.TableReference.newBuilder().build()) diff --git a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/BaseBigQueryReadClientTest.java b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/BaseBigQueryReadClientTest.java index b6266bdc5f..c4ecfc83e9 100644 --- a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/BaseBigQueryReadClientTest.java +++ b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/BaseBigQueryReadClientTest.java @@ -85,7 +85,7 @@ public void tearDown() throws Exception { public void createReadSessionTest() throws Exception { ReadSession expectedResponse = ReadSession.newBuilder() - .setName(ReadSessionName.of("[PROJECT]", "[LOCATION]", "[SESSION]").toString()) + .setName("name3373707") .setExpireTime(Timestamp.newBuilder().build()) .setDataFormat(DataFormat.forNumber(0)) .setTable(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString()) @@ -135,7 +135,7 @@ public void createReadSessionExceptionTest() throws Exception { public void createReadSessionTest2() throws Exception { ReadSession expectedResponse = ReadSession.newBuilder() - .setName(ReadSessionName.of("[PROJECT]", "[LOCATION]", "[SESSION]").toString()) + .setName("name3373707") .setExpireTime(Timestamp.newBuilder().build()) .setDataFormat(DataFormat.forNumber(0)) .setTable(TableName.of("[PROJECT]", "[DATASET]", "[TABLE]").toString()) diff --git a/proto-google-cloud-bigquerystorage-v1/clirr-ignored-differences.xml b/proto-google-cloud-bigquerystorage-v1/clirr-ignored-differences.xml index 78fef92e9f..198b5abc91 100644 --- a/proto-google-cloud-bigquerystorage-v1/clirr-ignored-differences.xml +++ b/proto-google-cloud-bigquerystorage-v1/clirr-ignored-differences.xml @@ -17,4 +17,20 @@ com/google/cloud/bigquery/storage/v1/*OrBuilder boolean has*(*) + + 8001 + com/google/cloud/bigquery/storage/v1/ReadSessionName + + + 8001 + com/google/cloud/bigquery/storage/v1/ReadSessionName$Builder + + + 8001 + com/google/cloud/bigquery/storage/v1/TableName + + + 8001 + com/google/cloud/bigquery/storage/v1/TableName$Builder + \ No newline at end of file diff --git a/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ReadSessionName.java b/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ReadSessionName.java deleted file mode 100644 index 3e3c9454c4..0000000000 --- a/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ReadSessionName.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2021 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.cloud.bigquery.storage.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 ReadSessionName implements ResourceName { - private static final PathTemplate PROJECT_LOCATION_SESSION = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/locations/{location}/sessions/{session}"); - private volatile Map fieldValuesMap; - private final String project; - private final String location; - private final String session; - - @Deprecated - protected ReadSessionName() { - project = null; - location = null; - session = null; - } - - private ReadSessionName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - session = Preconditions.checkNotNull(builder.getSession()); - } - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getSession() { - return session; - } - - public static Builder newBuilder() { - return new Builder(); - } - - public Builder toBuilder() { - return new Builder(this); - } - - public static ReadSessionName of(String project, String location, String session) { - return newBuilder().setProject(project).setLocation(location).setSession(session).build(); - } - - public static String format(String project, String location, String session) { - return newBuilder() - .setProject(project) - .setLocation(location) - .setSession(session) - .build() - .toString(); - } - - public static ReadSessionName parse(String formattedString) { - if (formattedString.isEmpty()) { - return null; - } - Map matchMap = - PROJECT_LOCATION_SESSION.validatedMatch( - formattedString, "ReadSessionName.parse: formattedString not in valid format"); - return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("session")); - } - - 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 (ReadSessionName value : values) { - if (value == null) { - list.add(""); - } else { - list.add(value.toString()); - } - } - return list; - } - - public static boolean isParsableFrom(String formattedString) { - return PROJECT_LOCATION_SESSION.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 (location != null) { - fieldMapBuilder.put("location", location); - } - if (session != null) { - fieldMapBuilder.put("session", session); - } - fieldValuesMap = fieldMapBuilder.build(); - } - } - } - return fieldValuesMap; - } - - public String getFieldValue(String fieldName) { - return getFieldValuesMap().get(fieldName); - } - - @Override - public String toString() { - return PROJECT_LOCATION_SESSION.instantiate( - "project", project, "location", location, "session", session); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - ReadSessionName that = ((ReadSessionName) o); - return Objects.equals(this.project, that.project) - && Objects.equals(this.location, that.location) - && Objects.equals(this.session, that.session); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(location); - h *= 1000003; - h ^= Objects.hashCode(session); - return h; - } - - /** Builder for projects/{project}/locations/{location}/sessions/{session}. */ - public static class Builder { - private String project; - private String location; - private String session; - - protected Builder() {} - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getSession() { - return session; - } - - public Builder setProject(String project) { - this.project = project; - return this; - } - - public Builder setLocation(String location) { - this.location = location; - return this; - } - - public Builder setSession(String session) { - this.session = session; - return this; - } - - private Builder(ReadSessionName readSessionName) { - this.project = readSessionName.project; - this.location = readSessionName.location; - this.session = readSessionName.session; - } - - public ReadSessionName build() { - return new ReadSessionName(this); - } - } -} diff --git a/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableName.java b/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableName.java deleted file mode 100644 index d4baf9c6b8..0000000000 --- a/proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableName.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright 2021 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.cloud.bigquery.storage.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 TableName implements ResourceName { - private static final PathTemplate PROJECT_DATASET_TABLE = - PathTemplate.createWithoutUrlEncoding("projects/{project}/datasets/{dataset}/tables/{table}"); - private volatile Map fieldValuesMap; - private final String project; - private final String dataset; - private final String table; - - @Deprecated - protected TableName() { - project = null; - dataset = null; - table = null; - } - - private TableName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - dataset = Preconditions.checkNotNull(builder.getDataset()); - table = Preconditions.checkNotNull(builder.getTable()); - } - - public String getProject() { - return project; - } - - public String getDataset() { - return dataset; - } - - public String getTable() { - return table; - } - - public static Builder newBuilder() { - return new Builder(); - } - - public Builder toBuilder() { - return new Builder(this); - } - - public static TableName of(String project, String dataset, String table) { - return newBuilder().setProject(project).setDataset(dataset).setTable(table).build(); - } - - public static String format(String project, String dataset, String table) { - return newBuilder().setProject(project).setDataset(dataset).setTable(table).build().toString(); - } - - public static TableName parse(String formattedString) { - if (formattedString.isEmpty()) { - return null; - } - Map matchMap = - PROJECT_DATASET_TABLE.validatedMatch( - formattedString, "TableName.parse: formattedString not in valid format"); - return of(matchMap.get("project"), matchMap.get("dataset"), matchMap.get("table")); - } - - 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 (TableName value : values) { - if (value == null) { - list.add(""); - } else { - list.add(value.toString()); - } - } - return list; - } - - public static boolean isParsableFrom(String formattedString) { - return PROJECT_DATASET_TABLE.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 (dataset != null) { - fieldMapBuilder.put("dataset", dataset); - } - if (table != null) { - fieldMapBuilder.put("table", table); - } - fieldValuesMap = fieldMapBuilder.build(); - } - } - } - return fieldValuesMap; - } - - public String getFieldValue(String fieldName) { - return getFieldValuesMap().get(fieldName); - } - - @Override - public String toString() { - return PROJECT_DATASET_TABLE.instantiate( - "project", project, "dataset", dataset, "table", table); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - TableName that = ((TableName) o); - return Objects.equals(this.project, that.project) - && Objects.equals(this.dataset, that.dataset) - && Objects.equals(this.table, that.table); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(dataset); - h *= 1000003; - h ^= Objects.hashCode(table); - return h; - } - - /** Builder for projects/{project}/datasets/{dataset}/tables/{table}. */ - public static class Builder { - private String project; - private String dataset; - private String table; - - protected Builder() {} - - public String getProject() { - return project; - } - - public String getDataset() { - return dataset; - } - - public String getTable() { - return table; - } - - public Builder setProject(String project) { - this.project = project; - return this; - } - - public Builder setDataset(String dataset) { - this.dataset = dataset; - return this; - } - - public Builder setTable(String table) { - this.table = table; - return this; - } - - private Builder(TableName tableName) { - this.project = tableName.project; - this.dataset = tableName.dataset; - this.table = tableName.table; - } - - public TableName build() { - return new TableName(this); - } - } -} diff --git a/proto-google-cloud-bigquerystorage-v1beta1/clirr-ignored-differences.xml b/proto-google-cloud-bigquerystorage-v1beta1/clirr-ignored-differences.xml new file mode 100644 index 0000000000..135565fd85 --- /dev/null +++ b/proto-google-cloud-bigquerystorage-v1beta1/clirr-ignored-differences.xml @@ -0,0 +1,20 @@ + + + + + 8001 + com/google/cloud/bigquery/storage/v1beta1/ReadSessionName + + + 8001 + com/google/cloud/bigquery/storage/v1beta1/ReadSessionName$Builder + + + 8001 + com/google/cloud/bigquery/storage/v1beta1/StreamName + + + 8001 + com/google/cloud/bigquery/storage/v1beta1/StreamName$Builder + + diff --git a/proto-google-cloud-bigquerystorage-v1beta1/src/main/java/com/google/cloud/bigquery/storage/v1beta1/ReadSessionName.java b/proto-google-cloud-bigquerystorage-v1beta1/src/main/java/com/google/cloud/bigquery/storage/v1beta1/ReadSessionName.java deleted file mode 100644 index 609d306414..0000000000 --- a/proto-google-cloud-bigquerystorage-v1beta1/src/main/java/com/google/cloud/bigquery/storage/v1beta1/ReadSessionName.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2021 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.cloud.bigquery.storage.v1beta1; - -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 ReadSessionName implements ResourceName { - private static final PathTemplate PROJECT_LOCATION_SESSION = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/locations/{location}/sessions/{session}"); - private volatile Map fieldValuesMap; - private final String project; - private final String location; - private final String session; - - @Deprecated - protected ReadSessionName() { - project = null; - location = null; - session = null; - } - - private ReadSessionName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - session = Preconditions.checkNotNull(builder.getSession()); - } - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getSession() { - return session; - } - - public static Builder newBuilder() { - return new Builder(); - } - - public Builder toBuilder() { - return new Builder(this); - } - - public static ReadSessionName of(String project, String location, String session) { - return newBuilder().setProject(project).setLocation(location).setSession(session).build(); - } - - public static String format(String project, String location, String session) { - return newBuilder() - .setProject(project) - .setLocation(location) - .setSession(session) - .build() - .toString(); - } - - public static ReadSessionName parse(String formattedString) { - if (formattedString.isEmpty()) { - return null; - } - Map matchMap = - PROJECT_LOCATION_SESSION.validatedMatch( - formattedString, "ReadSessionName.parse: formattedString not in valid format"); - return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("session")); - } - - 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 (ReadSessionName value : values) { - if (value == null) { - list.add(""); - } else { - list.add(value.toString()); - } - } - return list; - } - - public static boolean isParsableFrom(String formattedString) { - return PROJECT_LOCATION_SESSION.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 (location != null) { - fieldMapBuilder.put("location", location); - } - if (session != null) { - fieldMapBuilder.put("session", session); - } - fieldValuesMap = fieldMapBuilder.build(); - } - } - } - return fieldValuesMap; - } - - public String getFieldValue(String fieldName) { - return getFieldValuesMap().get(fieldName); - } - - @Override - public String toString() { - return PROJECT_LOCATION_SESSION.instantiate( - "project", project, "location", location, "session", session); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - ReadSessionName that = ((ReadSessionName) o); - return Objects.equals(this.project, that.project) - && Objects.equals(this.location, that.location) - && Objects.equals(this.session, that.session); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(location); - h *= 1000003; - h ^= Objects.hashCode(session); - return h; - } - - /** Builder for projects/{project}/locations/{location}/sessions/{session}. */ - public static class Builder { - private String project; - private String location; - private String session; - - protected Builder() {} - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getSession() { - return session; - } - - public Builder setProject(String project) { - this.project = project; - return this; - } - - public Builder setLocation(String location) { - this.location = location; - return this; - } - - public Builder setSession(String session) { - this.session = session; - return this; - } - - private Builder(ReadSessionName readSessionName) { - this.project = readSessionName.project; - this.location = readSessionName.location; - this.session = readSessionName.session; - } - - public ReadSessionName build() { - return new ReadSessionName(this); - } - } -} diff --git a/proto-google-cloud-bigquerystorage-v1beta1/src/main/java/com/google/cloud/bigquery/storage/v1beta1/StreamName.java b/proto-google-cloud-bigquerystorage-v1beta1/src/main/java/com/google/cloud/bigquery/storage/v1beta1/StreamName.java deleted file mode 100644 index 44aa8c1bb5..0000000000 --- a/proto-google-cloud-bigquerystorage-v1beta1/src/main/java/com/google/cloud/bigquery/storage/v1beta1/StreamName.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2021 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.cloud.bigquery.storage.v1beta1; - -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 StreamName implements ResourceName { - private static final PathTemplate PROJECT_LOCATION_STREAM = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/locations/{location}/streams/{stream}"); - private volatile Map fieldValuesMap; - private final String project; - private final String location; - private final String stream; - - @Deprecated - protected StreamName() { - project = null; - location = null; - stream = null; - } - - private StreamName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - stream = Preconditions.checkNotNull(builder.getStream()); - } - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getStream() { - return stream; - } - - public static Builder newBuilder() { - return new Builder(); - } - - public Builder toBuilder() { - return new Builder(this); - } - - public static StreamName of(String project, String location, String stream) { - return newBuilder().setProject(project).setLocation(location).setStream(stream).build(); - } - - public static String format(String project, String location, String stream) { - return newBuilder() - .setProject(project) - .setLocation(location) - .setStream(stream) - .build() - .toString(); - } - - public static StreamName parse(String formattedString) { - if (formattedString.isEmpty()) { - return null; - } - Map matchMap = - PROJECT_LOCATION_STREAM.validatedMatch( - formattedString, "StreamName.parse: formattedString not in valid format"); - return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("stream")); - } - - 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 (StreamName value : values) { - if (value == null) { - list.add(""); - } else { - list.add(value.toString()); - } - } - return list; - } - - public static boolean isParsableFrom(String formattedString) { - return PROJECT_LOCATION_STREAM.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 (location != null) { - fieldMapBuilder.put("location", location); - } - if (stream != null) { - fieldMapBuilder.put("stream", stream); - } - fieldValuesMap = fieldMapBuilder.build(); - } - } - } - return fieldValuesMap; - } - - public String getFieldValue(String fieldName) { - return getFieldValuesMap().get(fieldName); - } - - @Override - public String toString() { - return PROJECT_LOCATION_STREAM.instantiate( - "project", project, "location", location, "stream", stream); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - StreamName that = ((StreamName) o); - return Objects.equals(this.project, that.project) - && Objects.equals(this.location, that.location) - && Objects.equals(this.stream, that.stream); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(location); - h *= 1000003; - h ^= Objects.hashCode(stream); - return h; - } - - /** Builder for projects/{project}/locations/{location}/streams/{stream}. */ - public static class Builder { - private String project; - private String location; - private String stream; - - protected Builder() {} - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getStream() { - return stream; - } - - public Builder setProject(String project) { - this.project = project; - return this; - } - - public Builder setLocation(String location) { - this.location = location; - return this; - } - - public Builder setStream(String stream) { - this.stream = stream; - return this; - } - - private Builder(StreamName streamName) { - this.project = streamName.project; - this.location = streamName.location; - this.stream = streamName.stream; - } - - public StreamName build() { - return new StreamName(this); - } - } -} diff --git a/proto-google-cloud-bigquerystorage-v1beta2/clirr-ignored-differences.xml b/proto-google-cloud-bigquerystorage-v1beta2/clirr-ignored-differences.xml index 6e03637b76..0fcdbf3bf4 100644 --- a/proto-google-cloud-bigquerystorage-v1beta2/clirr-ignored-differences.xml +++ b/proto-google-cloud-bigquerystorage-v1beta2/clirr-ignored-differences.xml @@ -17,4 +17,12 @@ com/google/cloud/bigquery/storage/v1beta2/*OrBuilder boolean has*(*) + + 8001 + com/google/cloud/bigquery/storage/v1beta2/ReadSessionName + + + 8001 + com/google/cloud/bigquery/storage/v1beta2/ReadSessionName$Builder + \ No newline at end of file diff --git a/proto-google-cloud-bigquerystorage-v1beta2/src/main/java/com/google/cloud/bigquery/storage/v1beta2/ReadSessionName.java b/proto-google-cloud-bigquerystorage-v1beta2/src/main/java/com/google/cloud/bigquery/storage/v1beta2/ReadSessionName.java deleted file mode 100644 index 1dd7fe2893..0000000000 --- a/proto-google-cloud-bigquerystorage-v1beta2/src/main/java/com/google/cloud/bigquery/storage/v1beta2/ReadSessionName.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2021 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.cloud.bigquery.storage.v1beta2; - -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 ReadSessionName implements ResourceName { - private static final PathTemplate PROJECT_LOCATION_SESSION = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/locations/{location}/sessions/{session}"); - private volatile Map fieldValuesMap; - private final String project; - private final String location; - private final String session; - - @Deprecated - protected ReadSessionName() { - project = null; - location = null; - session = null; - } - - private ReadSessionName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - session = Preconditions.checkNotNull(builder.getSession()); - } - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getSession() { - return session; - } - - public static Builder newBuilder() { - return new Builder(); - } - - public Builder toBuilder() { - return new Builder(this); - } - - public static ReadSessionName of(String project, String location, String session) { - return newBuilder().setProject(project).setLocation(location).setSession(session).build(); - } - - public static String format(String project, String location, String session) { - return newBuilder() - .setProject(project) - .setLocation(location) - .setSession(session) - .build() - .toString(); - } - - public static ReadSessionName parse(String formattedString) { - if (formattedString.isEmpty()) { - return null; - } - Map matchMap = - PROJECT_LOCATION_SESSION.validatedMatch( - formattedString, "ReadSessionName.parse: formattedString not in valid format"); - return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("session")); - } - - 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 (ReadSessionName value : values) { - if (value == null) { - list.add(""); - } else { - list.add(value.toString()); - } - } - return list; - } - - public static boolean isParsableFrom(String formattedString) { - return PROJECT_LOCATION_SESSION.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 (location != null) { - fieldMapBuilder.put("location", location); - } - if (session != null) { - fieldMapBuilder.put("session", session); - } - fieldValuesMap = fieldMapBuilder.build(); - } - } - } - return fieldValuesMap; - } - - public String getFieldValue(String fieldName) { - return getFieldValuesMap().get(fieldName); - } - - @Override - public String toString() { - return PROJECT_LOCATION_SESSION.instantiate( - "project", project, "location", location, "session", session); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - ReadSessionName that = ((ReadSessionName) o); - return Objects.equals(this.project, that.project) - && Objects.equals(this.location, that.location) - && Objects.equals(this.session, that.session); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(location); - h *= 1000003; - h ^= Objects.hashCode(session); - return h; - } - - /** Builder for projects/{project}/locations/{location}/sessions/{session}. */ - public static class Builder { - private String project; - private String location; - private String session; - - protected Builder() {} - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getSession() { - return session; - } - - public Builder setProject(String project) { - this.project = project; - return this; - } - - public Builder setLocation(String location) { - this.location = location; - return this; - } - - public Builder setSession(String session) { - this.session = session; - return this; - } - - private Builder(ReadSessionName readSessionName) { - this.project = readSessionName.project; - this.location = readSessionName.location; - this.session = readSessionName.session; - } - - public ReadSessionName build() { - return new ReadSessionName(this); - } - } -} diff --git a/synth.metadata b/synth.metadata index abf54df02f..80003b694f 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,31 +11,31 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquerystorage.git", - "sha": "dbe2b9bfc66849d605e74361ad058d95f558a397" + "sha": "93a0eaeb520b803e56d61087f2ffb4f6beaa83ed" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "551681f25e36b11829e87e580281350461f4f3f5", - "internalRef": "379784268" + "sha": "d9eaf41de44d953458b18712a3f240bb4c564e48", + "internalRef": "388535346" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "551681f25e36b11829e87e580281350461f4f3f5", - "internalRef": "379784268" + "sha": "d9eaf41de44d953458b18712a3f240bb4c564e48", + "internalRef": "388535346" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "551681f25e36b11829e87e580281350461f4f3f5", - "internalRef": "379784268" + "sha": "d9eaf41de44d953458b18712a3f240bb4c564e48", + "internalRef": "388535346" } }, { @@ -210,7 +210,6 @@ "proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ReadRowsResponse.java", "proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ReadRowsResponseOrBuilder.java", "proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ReadSession.java", - "proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ReadSessionName.java", "proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ReadSessionOrBuilder.java", "proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ReadStream.java", "proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ReadStreamName.java", @@ -223,7 +222,6 @@ "proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/StreamProto.java", "proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/StreamStats.java", "proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/StreamStatsOrBuilder.java", - "proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/TableName.java", "proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ThrottleState.java", "proto-google-cloud-bigquerystorage-v1/src/main/java/com/google/cloud/bigquery/storage/v1/ThrottleStateOrBuilder.java", "proto-google-cloud-bigquerystorage-v1/src/main/proto/google/cloud/bigquery/storage/v1/arrow.proto", @@ -234,9 +232,7 @@ "proto-google-cloud-bigquerystorage-v1beta1/src/main/java/com/google/cloud/bigquery/storage/v1beta1/AvroProto.java", "proto-google-cloud-bigquerystorage-v1beta1/src/main/java/com/google/cloud/bigquery/storage/v1beta1/ProjectName.java", "proto-google-cloud-bigquerystorage-v1beta1/src/main/java/com/google/cloud/bigquery/storage/v1beta1/ReadOptions.java", - "proto-google-cloud-bigquerystorage-v1beta1/src/main/java/com/google/cloud/bigquery/storage/v1beta1/ReadSessionName.java", "proto-google-cloud-bigquerystorage-v1beta1/src/main/java/com/google/cloud/bigquery/storage/v1beta1/Storage.java", - "proto-google-cloud-bigquerystorage-v1beta1/src/main/java/com/google/cloud/bigquery/storage/v1beta1/StreamName.java", "proto-google-cloud-bigquerystorage-v1beta1/src/main/java/com/google/cloud/bigquery/storage/v1beta1/TableReferenceProto.java", "proto-google-cloud-bigquerystorage-v1beta1/src/main/proto/google/cloud/bigquery/storage/v1beta1/arrow.proto", "proto-google-cloud-bigquerystorage-v1beta1/src/main/proto/google/cloud/bigquery/storage/v1beta1/avro.proto", @@ -289,7 +285,6 @@ "proto-google-cloud-bigquerystorage-v1beta2/src/main/java/com/google/cloud/bigquery/storage/v1beta2/ReadRowsResponse.java", "proto-google-cloud-bigquerystorage-v1beta2/src/main/java/com/google/cloud/bigquery/storage/v1beta2/ReadRowsResponseOrBuilder.java", "proto-google-cloud-bigquerystorage-v1beta2/src/main/java/com/google/cloud/bigquery/storage/v1beta2/ReadSession.java", - "proto-google-cloud-bigquerystorage-v1beta2/src/main/java/com/google/cloud/bigquery/storage/v1beta2/ReadSessionName.java", "proto-google-cloud-bigquerystorage-v1beta2/src/main/java/com/google/cloud/bigquery/storage/v1beta2/ReadSessionOrBuilder.java", "proto-google-cloud-bigquerystorage-v1beta2/src/main/java/com/google/cloud/bigquery/storage/v1beta2/ReadStream.java", "proto-google-cloud-bigquerystorage-v1beta2/src/main/java/com/google/cloud/bigquery/storage/v1beta2/ReadStreamName.java",