A "callable" method. This type of method takes no parameters and returns an immutable API
+ * callable object, which can be used to initiate calls to the service.
*
*
* See the individual methods for example code.
@@ -83,8 +83,8 @@ public class ErrorGroupServiceApi implements AutoCloseable {
private final ScheduledExecutorService executor;
private final List closeables = new ArrayList<>();
- private final ApiCallable getGroupCallable;
- private final ApiCallable updateGroupCallable;
+ private final UnaryApiCallable getGroupCallable;
+ private final UnaryApiCallable updateGroupCallable;
private static final PathTemplate GROUP_PATH_TEMPLATE =
PathTemplate.createWithoutUrlEncoding("projects/{project}/groups/{group}");
@@ -130,9 +130,9 @@ protected ErrorGroupServiceApi(ErrorGroupServiceSettings settings) throws IOExce
this.channel = settings.getChannelProvider().getOrBuildChannel(this.executor);
this.getGroupCallable =
- ApiCallable.create(settings.getGroupSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.getGroupSettings(), this.channel, this.executor);
this.updateGroupCallable =
- ApiCallable.create(settings.updateGroupSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.updateGroupSettings(), this.channel, this.executor);
if (settings.getChannelProvider().shouldAutoClose()) {
closeables.add(
@@ -226,7 +226,7 @@ private final ErrorGroup getGroup(GetGroupRequest request) {
* }
*
*/
- public final ApiCallable getGroupCallable() {
+ public final UnaryApiCallable getGroupCallable() {
return getGroupCallable;
}
@@ -292,7 +292,7 @@ private final ErrorGroup updateGroup(UpdateGroupRequest request) {
* }
*
*/
- public final ApiCallable updateGroupCallable() {
+ public final UnaryApiCallable updateGroupCallable() {
return updateGroupCallable;
}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorGroupServiceSettings.java b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorGroupServiceSettings.java
index 4dc8bbeae7f1..5b5d9016960e 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorGroupServiceSettings.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorGroupServiceSettings.java
@@ -15,9 +15,9 @@
import com.google.api.gax.core.ConnectionSettings;
import com.google.api.gax.core.RetrySettings;
-import com.google.api.gax.grpc.ApiCallSettings;
import com.google.api.gax.grpc.ServiceApiSettings;
import com.google.api.gax.grpc.SimpleCallSettings;
+import com.google.api.gax.grpc.UnaryApiCallSettings;
import com.google.auth.Credentials;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -140,7 +140,7 @@ private ErrorGroupServiceSettings(Builder settingsBuilder) throws IOException {
/** Builder for ErrorGroupServiceSettings. */
public static class Builder extends ServiceApiSettings.Builder {
- private final ImmutableList methodSettingsBuilders;
+ private final ImmutableList unaryMethodSettingsBuilders;
private final SimpleCallSettings.Builder getGroupSettings;
private final SimpleCallSettings.Builder updateGroupSettings;
@@ -184,8 +184,8 @@ private Builder() {
updateGroupSettings =
SimpleCallSettings.newBuilder(ErrorGroupServiceGrpc.METHOD_UPDATE_GROUP);
- methodSettingsBuilders =
- ImmutableList.of(getGroupSettings, updateGroupSettings);
+ unaryMethodSettingsBuilders =
+ ImmutableList.of(getGroupSettings, updateGroupSettings);
}
private static Builder createDefault() {
@@ -210,8 +210,8 @@ private Builder(ErrorGroupServiceSettings settings) {
getGroupSettings = settings.getGroupSettings.toBuilder();
updateGroupSettings = settings.updateGroupSettings.toBuilder();
- methodSettingsBuilders =
- ImmutableList.of(getGroupSettings, updateGroupSettings);
+ unaryMethodSettingsBuilders =
+ ImmutableList.of(getGroupSettings, updateGroupSettings);
}
@Override
@@ -262,11 +262,14 @@ public Builder setClientLibHeader(String name, String version) {
}
/**
- * Applies the given settings to all of the API methods in this service. Only values that are
- * non-null will be applied, so this method is not capable of un-setting any values.
+ * Applies the given settings to all of the unary API methods in this service. Only values that
+ * are non-null will be applied, so this method is not capable of un-setting any values.
+ *
+ * Note: This method does not support applying settings to streaming methods.
*/
- public Builder applyToAllApiMethods(ApiCallSettings.Builder apiCallSettings) throws Exception {
- super.applyToAllApiMethods(methodSettingsBuilders, apiCallSettings);
+ public Builder applyToAllApiMethods(UnaryApiCallSettings.Builder apiCallSettings)
+ throws Exception {
+ super.applyToAllApiMethods(unaryMethodSettingsBuilders, apiCallSettings);
return this;
}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceApi.java b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceApi.java
index f333c555e500..c486708f6616 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceApi.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceApi.java
@@ -13,13 +13,13 @@
*/
package com.google.cloud.errorreporting.spi.v1beta1;
-import com.google.api.gax.core.PagedListResponse;
-import com.google.api.gax.grpc.ApiCallable;
+import static com.google.cloud.errorreporting.spi.v1beta1.PagedResponseWrappers.ListEventsPagedResponse;
+import static com.google.cloud.errorreporting.spi.v1beta1.PagedResponseWrappers.ListGroupStatsPagedResponse;
+
+import com.google.api.gax.grpc.UnaryApiCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest;
import com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse;
-import com.google.devtools.clouderrorreporting.v1beta1.ErrorEvent;
-import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroupStats;
import com.google.devtools.clouderrorreporting.v1beta1.ListEventsRequest;
import com.google.devtools.clouderrorreporting.v1beta1.ListEventsResponse;
import com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest;
@@ -62,8 +62,8 @@
*
A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
- * A "callable" method. This type of method takes no parameters and returns an immutable
- * ApiCallable object, which can be used to initiate calls to the service.
+ * A "callable" method. This type of method takes no parameters and returns an immutable API
+ * callable object, which can be used to initiate calls to the service.
*
*
* See the individual methods for example code.
@@ -91,16 +91,14 @@ public class ErrorStatsServiceApi implements AutoCloseable {
private final ScheduledExecutorService executor;
private final List closeables = new ArrayList<>();
- private final ApiCallable listGroupStatsCallable;
- private final ApiCallable<
- ListGroupStatsRequest,
- PagedListResponse>
+ private final UnaryApiCallable
+ listGroupStatsCallable;
+ private final UnaryApiCallable
listGroupStatsPagedCallable;
- private final ApiCallable listEventsCallable;
- private final ApiCallable<
- ListEventsRequest, PagedListResponse>
+ private final UnaryApiCallable listEventsCallable;
+ private final UnaryApiCallable
listEventsPagedCallable;
- private final ApiCallable deleteEventsCallable;
+ private final UnaryApiCallable deleteEventsCallable;
private static final PathTemplate PROJECT_PATH_TEMPLATE =
PathTemplate.createWithoutUrlEncoding("projects/{project}");
@@ -139,16 +137,17 @@ protected ErrorStatsServiceApi(ErrorStatsServiceSettings settings) throws IOExce
this.channel = settings.getChannelProvider().getOrBuildChannel(this.executor);
this.listGroupStatsCallable =
- ApiCallable.create(settings.listGroupStatsSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.listGroupStatsSettings(), this.channel, this.executor);
this.listGroupStatsPagedCallable =
- ApiCallable.createPagedVariant(
+ UnaryApiCallable.createPagedVariant(
settings.listGroupStatsSettings(), this.channel, this.executor);
this.listEventsCallable =
- ApiCallable.create(settings.listEventsSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.listEventsSettings(), this.channel, this.executor);
this.listEventsPagedCallable =
- ApiCallable.createPagedVariant(settings.listEventsSettings(), this.channel, this.executor);
+ UnaryApiCallable.createPagedVariant(
+ settings.listEventsSettings(), this.channel, this.executor);
this.deleteEventsCallable =
- ApiCallable.create(settings.deleteEventsSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.deleteEventsSettings(), this.channel, this.executor);
if (settings.getChannelProvider().shouldAutoClose()) {
closeables.add(
@@ -195,13 +194,14 @@ public final ErrorStatsServiceSettings getSettings() {
* href="https://support.google.com/cloud/answer/6158840">Google Cloud Platform project
* ID</a>.
* Example: <code>projects/my-project-123</code>.
- * @param timeRange [Required] List data for the given time range. The service is tuned for
- * retrieving data up to (approximately) 'now'. Retrieving data for arbitrary time periods in
- * the past can result in higher response times or in returning incomplete results.
+ * @param timeRange [Required] List data for the given time range. Only
+ * <code>ErrorGroupStats</code> with a non-zero count in the given time range are
+ * returned, unless the request contains an explicit group_id list. If a group_id list is
+ * given, also <code>ErrorGroupStats</code> with zero occurrences are returned.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final PagedListResponse
- listGroupStats(String projectName, QueryTimeRange timeRange) {
+ public final ListGroupStatsPagedResponse listGroupStats(
+ String projectName, QueryTimeRange timeRange) {
PROJECT_PATH_TEMPLATE.validate(projectName, "listGroupStats");
ListGroupStatsRequest request =
ListGroupStatsRequest.newBuilder()
@@ -234,8 +234,7 @@ public final ErrorStatsServiceSettings getSettings() {
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final PagedListResponse
- listGroupStats(ListGroupStatsRequest request) {
+ public final ListGroupStatsPagedResponse listGroupStats(ListGroupStatsRequest request) {
return listGroupStatsPagedCallable().call(request);
}
@@ -253,7 +252,7 @@ public final ErrorStatsServiceSettings getSettings() {
* .setProjectName(formattedProjectName)
* .setTimeRange(timeRange)
* .build();
- * ListenableFuture<PagedListResponse<ListGroupStatsRequest,ListGroupStatsResponse,ErrorGroupStats>> future = errorStatsServiceApi.listGroupStatsPagedCallable().futureCall(request);
+ * ListenableFuture<ListGroupStatsPagedResponse> future = errorStatsServiceApi.listGroupStatsPagedCallable().futureCall(request);
* // Do something
* for (ErrorGroupStats element : future.get().iterateAllElements()) {
* // doThingsWith(element);
@@ -261,9 +260,7 @@ public final ErrorStatsServiceSettings getSettings() {
* }
*
*/
- public final ApiCallable<
- ListGroupStatsRequest,
- PagedListResponse>
+ public final UnaryApiCallable
listGroupStatsPagedCallable() {
return listGroupStatsPagedCallable;
}
@@ -297,7 +294,8 @@ public final ErrorStatsServiceSettings getSettings() {
* }
*
*/
- public final ApiCallable listGroupStatsCallable() {
+ public final UnaryApiCallable
+ listGroupStatsCallable() {
return listGroupStatsCallable;
}
@@ -323,8 +321,7 @@ public final ApiCallable listGrou
* @param groupId [Required] The group for which events shall be returned.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final PagedListResponse listEvents(
- String projectName, String groupId) {
+ public final ListEventsPagedResponse listEvents(String projectName, String groupId) {
PROJECT_PATH_TEMPLATE.validate(projectName, "listEvents");
ListEventsRequest request =
ListEventsRequest.newBuilder().setProjectName(projectName).setGroupId(groupId).build();
@@ -354,8 +351,7 @@ public final PagedListResponse listEvents(
- ListEventsRequest request) {
+ public final ListEventsPagedResponse listEvents(ListEventsRequest request) {
return listEventsPagedCallable().call(request);
}
@@ -373,7 +369,7 @@ public final PagedListResponse
*/
- public final ApiCallable<
- ListEventsRequest, PagedListResponse>
+ public final UnaryApiCallable
listEventsPagedCallable() {
return listEventsPagedCallable;
}
@@ -416,7 +411,7 @@ public final PagedListResponse
*/
- public final ApiCallable listEventsCallable() {
+ public final UnaryApiCallable listEventsCallable() {
return listEventsCallable;
}
@@ -486,7 +481,7 @@ private final DeleteEventsResponse deleteEvents(DeleteEventsRequest request) {
* }
*
*/
- public final ApiCallable deleteEventsCallable() {
+ public final UnaryApiCallable deleteEventsCallable() {
return deleteEventsCallable;
}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceSettings.java b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceSettings.java
index b34dde3f867b..2dd7678f68be 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceSettings.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceSettings.java
@@ -13,13 +13,19 @@
*/
package com.google.cloud.errorreporting.spi.v1beta1;
+import static com.google.cloud.errorreporting.spi.v1beta1.PagedResponseWrappers.ListEventsPagedResponse;
+import static com.google.cloud.errorreporting.spi.v1beta1.PagedResponseWrappers.ListGroupStatsPagedResponse;
+
import com.google.api.gax.core.ConnectionSettings;
import com.google.api.gax.core.RetrySettings;
-import com.google.api.gax.grpc.ApiCallSettings;
+import com.google.api.gax.grpc.CallContext;
import com.google.api.gax.grpc.PageStreamingCallSettings;
import com.google.api.gax.grpc.PageStreamingDescriptor;
+import com.google.api.gax.grpc.PagedListResponseFactory;
import com.google.api.gax.grpc.ServiceApiSettings;
import com.google.api.gax.grpc.SimpleCallSettings;
+import com.google.api.gax.grpc.UnaryApiCallSettings;
+import com.google.api.gax.grpc.UnaryApiCallable;
import com.google.auth.Credentials;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -90,20 +96,22 @@ public class ErrorStatsServiceSettings extends ServiceApiSettings {
.build();
private final PageStreamingCallSettings<
- ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats>
+ ListGroupStatsRequest, ListGroupStatsResponse, ListGroupStatsPagedResponse>
listGroupStatsSettings;
- private final PageStreamingCallSettings
+ private final PageStreamingCallSettings<
+ ListEventsRequest, ListEventsResponse, ListEventsPagedResponse>
listEventsSettings;
private final SimpleCallSettings deleteEventsSettings;
/** Returns the object with the settings used for calls to listGroupStats. */
- public PageStreamingCallSettings
+ public PageStreamingCallSettings<
+ ListGroupStatsRequest, ListGroupStatsResponse, ListGroupStatsPagedResponse>
listGroupStatsSettings() {
return listGroupStatsSettings;
}
/** Returns the object with the settings used for calls to listEvents. */
- public PageStreamingCallSettings
+ public PageStreamingCallSettings
listEventsSettings() {
return listEventsSettings;
}
@@ -228,15 +236,45 @@ public Iterable extractResources(ListEventsResponse payload) {
}
};
+ private static final PagedListResponseFactory<
+ ListGroupStatsRequest, ListGroupStatsResponse, ListGroupStatsPagedResponse>
+ LIST_GROUP_STATS_PAGE_STR_FACT =
+ new PagedListResponseFactory<
+ ListGroupStatsRequest, ListGroupStatsResponse, ListGroupStatsPagedResponse>() {
+ @Override
+ public ListGroupStatsPagedResponse createPagedListResponse(
+ UnaryApiCallable callable,
+ ListGroupStatsRequest request,
+ CallContext context) {
+ return new ListGroupStatsPagedResponse(
+ callable, LIST_GROUP_STATS_PAGE_STR_DESC, request, context);
+ }
+ };
+
+ private static final PagedListResponseFactory<
+ ListEventsRequest, ListEventsResponse, ListEventsPagedResponse>
+ LIST_EVENTS_PAGE_STR_FACT =
+ new PagedListResponseFactory<
+ ListEventsRequest, ListEventsResponse, ListEventsPagedResponse>() {
+ @Override
+ public ListEventsPagedResponse createPagedListResponse(
+ UnaryApiCallable callable,
+ ListEventsRequest request,
+ CallContext context) {
+ return new ListEventsPagedResponse(
+ callable, LIST_EVENTS_PAGE_STR_DESC, request, context);
+ }
+ };
+
/** Builder for ErrorStatsServiceSettings. */
public static class Builder extends ServiceApiSettings.Builder {
- private final ImmutableList methodSettingsBuilders;
+ private final ImmutableList unaryMethodSettingsBuilders;
private final PageStreamingCallSettings.Builder<
- ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats>
+ ListGroupStatsRequest, ListGroupStatsResponse, ListGroupStatsPagedResponse>
listGroupStatsSettings;
private final PageStreamingCallSettings.Builder<
- ListEventsRequest, ListEventsResponse, ErrorEvent>
+ ListEventsRequest, ListEventsResponse, ListEventsPagedResponse>
listEventsSettings;
private final SimpleCallSettings.Builder
deleteEventsSettings;
@@ -277,17 +315,17 @@ private Builder() {
listGroupStatsSettings =
PageStreamingCallSettings.newBuilder(
- ErrorStatsServiceGrpc.METHOD_LIST_GROUP_STATS, LIST_GROUP_STATS_PAGE_STR_DESC);
+ ErrorStatsServiceGrpc.METHOD_LIST_GROUP_STATS, LIST_GROUP_STATS_PAGE_STR_FACT);
listEventsSettings =
PageStreamingCallSettings.newBuilder(
- ErrorStatsServiceGrpc.METHOD_LIST_EVENTS, LIST_EVENTS_PAGE_STR_DESC);
+ ErrorStatsServiceGrpc.METHOD_LIST_EVENTS, LIST_EVENTS_PAGE_STR_FACT);
deleteEventsSettings =
SimpleCallSettings.newBuilder(ErrorStatsServiceGrpc.METHOD_DELETE_EVENTS);
- methodSettingsBuilders =
- ImmutableList.of(
+ unaryMethodSettingsBuilders =
+ ImmutableList.of(
listGroupStatsSettings, listEventsSettings, deleteEventsSettings);
}
@@ -319,8 +357,8 @@ private Builder(ErrorStatsServiceSettings settings) {
listEventsSettings = settings.listEventsSettings.toBuilder();
deleteEventsSettings = settings.deleteEventsSettings.toBuilder();
- methodSettingsBuilders =
- ImmutableList.of(
+ unaryMethodSettingsBuilders =
+ ImmutableList.of(
listGroupStatsSettings, listEventsSettings, deleteEventsSettings);
}
@@ -372,23 +410,27 @@ public Builder setClientLibHeader(String name, String version) {
}
/**
- * Applies the given settings to all of the API methods in this service. Only values that are
- * non-null will be applied, so this method is not capable of un-setting any values.
+ * Applies the given settings to all of the unary API methods in this service. Only values that
+ * are non-null will be applied, so this method is not capable of un-setting any values.
+ *
+ * Note: This method does not support applying settings to streaming methods.
*/
- public Builder applyToAllApiMethods(ApiCallSettings.Builder apiCallSettings) throws Exception {
- super.applyToAllApiMethods(methodSettingsBuilders, apiCallSettings);
+ public Builder applyToAllApiMethods(UnaryApiCallSettings.Builder apiCallSettings)
+ throws Exception {
+ super.applyToAllApiMethods(unaryMethodSettingsBuilders, apiCallSettings);
return this;
}
/** Returns the builder for the settings used for calls to listGroupStats. */
public PageStreamingCallSettings.Builder<
- ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats>
+ ListGroupStatsRequest, ListGroupStatsResponse, ListGroupStatsPagedResponse>
listGroupStatsSettings() {
return listGroupStatsSettings;
}
/** Returns the builder for the settings used for calls to listEvents. */
- public PageStreamingCallSettings.Builder
+ public PageStreamingCallSettings.Builder<
+ ListEventsRequest, ListEventsResponse, ListEventsPagedResponse>
listEventsSettings() {
return listEventsSettings;
}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/PagedResponseWrappers.java b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/PagedResponseWrappers.java
new file mode 100644
index 000000000000..7b14a0f8ffd0
--- /dev/null
+++ b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/PagedResponseWrappers.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016 Google Inc. All Rights Reserved.
+ *
+ * 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.errorreporting.spi.v1beta1;
+
+import com.google.api.gax.grpc.CallContext;
+import com.google.api.gax.grpc.PageStreamingDescriptor;
+import com.google.api.gax.grpc.PagedListResponseImpl;
+import com.google.api.gax.grpc.UnaryApiCallable;
+import com.google.devtools.clouderrorreporting.v1beta1.ErrorEvent;
+import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroupStats;
+import com.google.devtools.clouderrorreporting.v1beta1.ListEventsRequest;
+import com.google.devtools.clouderrorreporting.v1beta1.ListEventsResponse;
+import com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest;
+import com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsResponse;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS
+/**
+ * Wrapper class to contain paged response types for page streaming methods. Each static class
+ * inside this wrapper class is used as the return type of one of an API method that implements the
+ * page streaming pattern.
+ */
+@javax.annotation.Generated("by GAPIC")
+public class PagedResponseWrappers {
+
+ public static class ListGroupStatsPagedResponse
+ extends PagedListResponseImpl<
+ ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats> {
+
+ public ListGroupStatsPagedResponse(
+ UnaryApiCallable callable,
+ PageStreamingDescriptor
+ pageDescriptor,
+ ListGroupStatsRequest request,
+ CallContext context) {
+ super(callable, pageDescriptor, request, context);
+ }
+ }
+
+ public static class ListEventsPagedResponse
+ extends PagedListResponseImpl {
+
+ public ListEventsPagedResponse(
+ UnaryApiCallable callable,
+ PageStreamingDescriptor pageDescriptor,
+ ListEventsRequest request,
+ CallContext context) {
+ super(callable, pageDescriptor, request, context);
+ }
+ }
+}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ReportErrorsServiceApi.java b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ReportErrorsServiceApi.java
index cdd5714e093e..02f5292cccfe 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ReportErrorsServiceApi.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ReportErrorsServiceApi.java
@@ -13,7 +13,7 @@
*/
package com.google.cloud.errorreporting.spi.v1beta1;
-import com.google.api.gax.grpc.ApiCallable;
+import com.google.api.gax.grpc.UnaryApiCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest;
import com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse;
@@ -56,8 +56,8 @@
* A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
- * A "callable" method. This type of method takes no parameters and returns an immutable
- * ApiCallable object, which can be used to initiate calls to the service.
+ * A "callable" method. This type of method takes no parameters and returns an immutable API
+ * callable object, which can be used to initiate calls to the service.
*
*
* See the individual methods for example code.
@@ -85,7 +85,7 @@ public class ReportErrorsServiceApi implements AutoCloseable {
private final ScheduledExecutorService executor;
private final List closeables = new ArrayList<>();
- private final ApiCallable
+ private final UnaryApiCallable
reportErrorEventCallable;
private static final PathTemplate PROJECT_PATH_TEMPLATE =
@@ -126,7 +126,7 @@ protected ReportErrorsServiceApi(ReportErrorsServiceSettings settings) throws IO
this.channel = settings.getChannelProvider().getOrBuildChannel(this.executor);
this.reportErrorEventCallable =
- ApiCallable.create(settings.reportErrorEventSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.reportErrorEventSettings(), this.channel, this.executor);
if (settings.getChannelProvider().shouldAutoClose()) {
closeables.add(
@@ -246,7 +246,7 @@ public final ReportErrorEventResponse reportErrorEvent(ReportErrorEventRequest r
* }
*
*/
- public final ApiCallable
+ public final UnaryApiCallable
reportErrorEventCallable() {
return reportErrorEventCallable;
}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ReportErrorsServiceSettings.java b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ReportErrorsServiceSettings.java
index a4b390017c31..0ee512a2ce06 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ReportErrorsServiceSettings.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ReportErrorsServiceSettings.java
@@ -15,9 +15,9 @@
import com.google.api.gax.core.ConnectionSettings;
import com.google.api.gax.core.RetrySettings;
-import com.google.api.gax.grpc.ApiCallSettings;
import com.google.api.gax.grpc.ServiceApiSettings;
import com.google.api.gax.grpc.SimpleCallSettings;
+import com.google.api.gax.grpc.UnaryApiCallSettings;
import com.google.auth.Credentials;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -134,7 +134,7 @@ private ReportErrorsServiceSettings(Builder settingsBuilder) throws IOException
/** Builder for ReportErrorsServiceSettings. */
public static class Builder extends ServiceApiSettings.Builder {
- private final ImmutableList methodSettingsBuilders;
+ private final ImmutableList unaryMethodSettingsBuilders;
private final SimpleCallSettings.Builder
reportErrorEventSettings;
@@ -176,7 +176,8 @@ private Builder() {
reportErrorEventSettings =
SimpleCallSettings.newBuilder(ReportErrorsServiceGrpc.METHOD_REPORT_ERROR_EVENT);
- methodSettingsBuilders = ImmutableList.of(reportErrorEventSettings);
+ unaryMethodSettingsBuilders =
+ ImmutableList.of(reportErrorEventSettings);
}
private static Builder createDefault() {
@@ -195,7 +196,8 @@ private Builder(ReportErrorsServiceSettings settings) {
reportErrorEventSettings = settings.reportErrorEventSettings.toBuilder();
- methodSettingsBuilders = ImmutableList.of(reportErrorEventSettings);
+ unaryMethodSettingsBuilders =
+ ImmutableList.of(reportErrorEventSettings);
}
@Override
@@ -246,11 +248,14 @@ public Builder setClientLibHeader(String name, String version) {
}
/**
- * Applies the given settings to all of the API methods in this service. Only values that are
- * non-null will be applied, so this method is not capable of un-setting any values.
+ * Applies the given settings to all of the unary API methods in this service. Only values that
+ * are non-null will be applied, so this method is not capable of un-setting any values.
+ *
+ * Note: This method does not support applying settings to streaming methods.
*/
- public Builder applyToAllApiMethods(ApiCallSettings.Builder apiCallSettings) throws Exception {
- super.applyToAllApiMethods(methodSettingsBuilders, apiCallSettings);
+ public Builder applyToAllApiMethods(UnaryApiCallSettings.Builder apiCallSettings)
+ throws Exception {
+ super.applyToAllApiMethods(unaryMethodSettingsBuilders, apiCallSettings);
return this;
}
diff --git a/google-cloud-errorreporting/src/test/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceTest.java b/google-cloud-errorreporting/src/test/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceTest.java
index df94dfc07b04..323f437c222e 100644
--- a/google-cloud-errorreporting/src/test/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceTest.java
+++ b/google-cloud-errorreporting/src/test/java/com/google/cloud/errorreporting/spi/v1beta1/ErrorStatsServiceTest.java
@@ -14,7 +14,9 @@
package com.google.cloud.errorreporting.spi.v1beta1;
-import com.google.api.gax.core.PagedListResponse;
+import static com.google.cloud.errorreporting.spi.v1beta1.PagedResponseWrappers.ListEventsPagedResponse;
+import static com.google.cloud.errorreporting.spi.v1beta1.PagedResponseWrappers.ListGroupStatsPagedResponse;
+
import com.google.api.gax.testing.MockGrpcService;
import com.google.api.gax.testing.MockServiceHelper;
import com.google.common.collect.Lists;
@@ -98,8 +100,8 @@ public void listGroupStatsTest() {
String formattedProjectName = ErrorStatsServiceApi.formatProjectName("[PROJECT]");
QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
- PagedListResponse
- pagedListResponse = api.listGroupStats(formattedProjectName, timeRange);
+ ListGroupStatsPagedResponse pagedListResponse =
+ api.listGroupStats(formattedProjectName, timeRange);
List resources = Lists.newArrayList(pagedListResponse.iterateAllElements());
Assert.assertEquals(1, resources.size());
@@ -131,8 +133,7 @@ public void listEventsTest() {
String formattedProjectName = ErrorStatsServiceApi.formatProjectName("[PROJECT]");
String groupId = "groupId506361563";
- PagedListResponse pagedListResponse =
- api.listEvents(formattedProjectName, groupId);
+ ListEventsPagedResponse pagedListResponse = api.listEvents(formattedProjectName, groupId);
List resources = Lists.newArrayList(pagedListResponse.iterateAllElements());
Assert.assertEquals(1, resources.size());
diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta1/LanguageServiceApi.java b/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta1/LanguageServiceApi.java
index 1f663b9929f6..9d63071e2aee 100644
--- a/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta1/LanguageServiceApi.java
+++ b/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta1/LanguageServiceApi.java
@@ -13,7 +13,7 @@
*/
package com.google.cloud.language.spi.v1beta1;
-import com.google.api.gax.grpc.ApiCallable;
+import com.google.api.gax.grpc.UnaryApiCallable;
import com.google.cloud.language.v1beta1.AnalyzeEntitiesRequest;
import com.google.cloud.language.v1beta1.AnalyzeEntitiesResponse;
import com.google.cloud.language.v1beta1.AnalyzeSentimentRequest;
@@ -60,8 +60,8 @@
* A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
- * A "callable" method. This type of method takes no parameters and returns an immutable
- * ApiCallable object, which can be used to initiate calls to the service.
+ * A "callable" method. This type of method takes no parameters and returns an immutable API
+ * callable object, which can be used to initiate calls to the service.
*
*
* See the individual methods for example code.
@@ -89,11 +89,11 @@ public class LanguageServiceApi implements AutoCloseable {
private final ScheduledExecutorService executor;
private final List closeables = new ArrayList<>();
- private final ApiCallable
+ private final UnaryApiCallable
analyzeSentimentCallable;
- private final ApiCallable
+ private final UnaryApiCallable
analyzeEntitiesCallable;
- private final ApiCallable annotateTextCallable;
+ private final UnaryApiCallable annotateTextCallable;
/** Constructs an instance of LanguageServiceApi with default settings. */
public static final LanguageServiceApi create() throws IOException {
@@ -119,11 +119,11 @@ protected LanguageServiceApi(LanguageServiceSettings settings) throws IOExceptio
this.channel = settings.getChannelProvider().getOrBuildChannel(this.executor);
this.analyzeSentimentCallable =
- ApiCallable.create(settings.analyzeSentimentSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.analyzeSentimentSettings(), this.channel, this.executor);
this.analyzeEntitiesCallable =
- ApiCallable.create(settings.analyzeEntitiesSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.analyzeEntitiesSettings(), this.channel, this.executor);
this.annotateTextCallable =
- ApiCallable.create(settings.annotateTextSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.annotateTextSettings(), this.channel, this.executor);
if (settings.getChannelProvider().shouldAutoClose()) {
closeables.add(
@@ -213,7 +213,7 @@ private final AnalyzeSentimentResponse analyzeSentiment(AnalyzeSentimentRequest
* }
*
*/
- public final ApiCallable
+ public final UnaryApiCallable
analyzeSentimentCallable() {
return analyzeSentimentCallable;
}
@@ -294,7 +294,7 @@ public final AnalyzeEntitiesResponse analyzeEntities(AnalyzeEntitiesRequest requ
* }
*
*/
- public final ApiCallable
+ public final UnaryApiCallable
analyzeEntitiesCallable() {
return analyzeEntitiesCallable;
}
@@ -385,7 +385,7 @@ public final AnnotateTextResponse annotateText(AnnotateTextRequest request) {
* }
*
*/
- public final ApiCallable annotateTextCallable() {
+ public final UnaryApiCallable annotateTextCallable() {
return annotateTextCallable;
}
diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta1/LanguageServiceSettings.java b/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta1/LanguageServiceSettings.java
index 394c2a7add5e..50533421b2c1 100644
--- a/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta1/LanguageServiceSettings.java
+++ b/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta1/LanguageServiceSettings.java
@@ -15,9 +15,9 @@
import com.google.api.gax.core.ConnectionSettings;
import com.google.api.gax.core.RetrySettings;
-import com.google.api.gax.grpc.ApiCallSettings;
import com.google.api.gax.grpc.ServiceApiSettings;
import com.google.api.gax.grpc.SimpleCallSettings;
+import com.google.api.gax.grpc.UnaryApiCallSettings;
import com.google.auth.Credentials;
import com.google.cloud.language.v1beta1.AnalyzeEntitiesRequest;
import com.google.cloud.language.v1beta1.AnalyzeEntitiesResponse;
@@ -153,7 +153,7 @@ private LanguageServiceSettings(Builder settingsBuilder) throws IOException {
/** Builder for LanguageServiceSettings. */
public static class Builder extends ServiceApiSettings.Builder {
- private final ImmutableList methodSettingsBuilders;
+ private final ImmutableList unaryMethodSettingsBuilders;
private final SimpleCallSettings.Builder
analyzeSentimentSettings;
@@ -205,8 +205,8 @@ private Builder() {
annotateTextSettings =
SimpleCallSettings.newBuilder(LanguageServiceGrpc.METHOD_ANNOTATE_TEXT);
- methodSettingsBuilders =
- ImmutableList.of(
+ unaryMethodSettingsBuilders =
+ ImmutableList.of(
analyzeSentimentSettings, analyzeEntitiesSettings, annotateTextSettings);
}
@@ -238,8 +238,8 @@ private Builder(LanguageServiceSettings settings) {
analyzeEntitiesSettings = settings.analyzeEntitiesSettings.toBuilder();
annotateTextSettings = settings.annotateTextSettings.toBuilder();
- methodSettingsBuilders =
- ImmutableList.of(
+ unaryMethodSettingsBuilders =
+ ImmutableList.of(
analyzeSentimentSettings, analyzeEntitiesSettings, annotateTextSettings);
}
@@ -291,11 +291,14 @@ public Builder setClientLibHeader(String name, String version) {
}
/**
- * Applies the given settings to all of the API methods in this service. Only values that are
- * non-null will be applied, so this method is not capable of un-setting any values.
+ * Applies the given settings to all of the unary API methods in this service. Only values that
+ * are non-null will be applied, so this method is not capable of un-setting any values.
+ *
+ * Note: This method does not support applying settings to streaming methods.
*/
- public Builder applyToAllApiMethods(ApiCallSettings.Builder apiCallSettings) throws Exception {
- super.applyToAllApiMethods(methodSettingsBuilders, apiCallSettings);
+ public Builder applyToAllApiMethods(UnaryApiCallSettings.Builder apiCallSettings)
+ throws Exception {
+ super.applyToAllApiMethods(unaryMethodSettingsBuilders, apiCallSettings);
return this;
}
diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta1/PagedResponseWrappers.java b/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta1/PagedResponseWrappers.java
new file mode 100644
index 000000000000..e3882450d408
--- /dev/null
+++ b/google-cloud-language/src/main/java/com/google/cloud/language/spi/v1beta1/PagedResponseWrappers.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2016 Google Inc. All Rights Reserved.
+ *
+ * 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.language.spi.v1beta1;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS
+/**
+ * Wrapper class to contain paged response types for page streaming methods. Each static class
+ * inside this wrapper class is used as the return type of one of an API method that implements the
+ * page streaming pattern.
+ */
+@javax.annotation.Generated("by GAPIC")
+public class PagedResponseWrappers {}
diff --git a/google-cloud-logging/pom.xml b/google-cloud-logging/pom.xml
index d2185f866bb2..c277ef51017f 100644
--- a/google-cloud-logging/pom.xml
+++ b/google-cloud-logging/pom.xml
@@ -30,7 +30,7 @@
com.google.api.grpc
grpc-google-logging-v2
- 0.1.0
+ 0.1.1
io.grpc
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/DefaultLoggingRpc.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/DefaultLoggingRpc.java
index a707c29d5a42..788c78453323 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/DefaultLoggingRpc.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/DefaultLoggingRpc.java
@@ -19,7 +19,7 @@
import static com.google.common.base.MoreObjects.firstNonNull;
import com.google.api.gax.core.ConnectionSettings;
-import com.google.api.gax.grpc.ApiCallSettings;
+import com.google.api.gax.grpc.UnaryApiCallSettings;
import com.google.api.gax.grpc.ApiException;
import com.google.cloud.AuthCredentials;
import com.google.cloud.GrpcServiceOptions.ExecutorFactory;
@@ -92,7 +92,7 @@ protected ExecutorFactory executorFactory() {
}
@Override
- protected ApiCallSettings.Builder apiCallSettings() {
+ protected UnaryApiCallSettings.Builder apiCallSettings() {
return super.apiCallSettings();
}
@@ -133,7 +133,7 @@ public DefaultLoggingRpc(LoggingOptions options) throws IOException {
logBuilder.provideChannelWith(connectionSettings);
metricsBuilder.provideChannelWith(connectionSettings);
}
- ApiCallSettings.Builder callSettingsBuilder = internalOptions.apiCallSettings();
+ UnaryApiCallSettings.Builder callSettingsBuilder = internalOptions.apiCallSettings();
confBuilder.applyToAllApiMethods(callSettingsBuilder);
logBuilder.applyToAllApiMethods(callSettingsBuilder);
metricsBuilder.applyToAllApiMethods(callSettingsBuilder);
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Api.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Api.java
index f49aca494e33..1c92911ade80 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Api.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Api.java
@@ -13,8 +13,9 @@
*/
package com.google.cloud.logging.spi.v2;
-import com.google.api.gax.core.PagedListResponse;
-import com.google.api.gax.grpc.ApiCallable;
+import static com.google.cloud.logging.spi.v2.PagedResponseWrappers.ListSinksPagedResponse;
+
+import com.google.api.gax.grpc.UnaryApiCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.logging.v2.CreateSinkRequest;
import com.google.logging.v2.DeleteSinkRequest;
@@ -61,8 +62,8 @@
* A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
- * A "callable" method. This type of method takes no parameters and returns an immutable
- * ApiCallable object, which can be used to initiate calls to the service.
+ * A "callable" method. This type of method takes no parameters and returns an immutable API
+ * callable object, which can be used to initiate calls to the service.
*
*
* See the individual methods for example code.
@@ -90,14 +91,12 @@ public class ConfigServiceV2Api implements AutoCloseable {
private final ScheduledExecutorService executor;
private final List closeables = new ArrayList<>();
- private final ApiCallable listSinksCallable;
- private final ApiCallable<
- ListSinksRequest, PagedListResponse>
- listSinksPagedCallable;
- private final ApiCallable getSinkCallable;
- private final ApiCallable createSinkCallable;
- private final ApiCallable updateSinkCallable;
- private final ApiCallable deleteSinkCallable;
+ private final UnaryApiCallable listSinksCallable;
+ private final UnaryApiCallable listSinksPagedCallable;
+ private final UnaryApiCallable getSinkCallable;
+ private final UnaryApiCallable createSinkCallable;
+ private final UnaryApiCallable updateSinkCallable;
+ private final UnaryApiCallable deleteSinkCallable;
private static final PathTemplate PARENT_PATH_TEMPLATE =
PathTemplate.createWithoutUrlEncoding("projects/{project}");
@@ -156,17 +155,18 @@ protected ConfigServiceV2Api(ConfigServiceV2Settings settings) throws IOExceptio
this.channel = settings.getChannelProvider().getOrBuildChannel(this.executor);
this.listSinksCallable =
- ApiCallable.create(settings.listSinksSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.listSinksSettings(), this.channel, this.executor);
this.listSinksPagedCallable =
- ApiCallable.createPagedVariant(settings.listSinksSettings(), this.channel, this.executor);
+ UnaryApiCallable.createPagedVariant(
+ settings.listSinksSettings(), this.channel, this.executor);
this.getSinkCallable =
- ApiCallable.create(settings.getSinkSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.getSinkSettings(), this.channel, this.executor);
this.createSinkCallable =
- ApiCallable.create(settings.createSinkSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.createSinkSettings(), this.channel, this.executor);
this.updateSinkCallable =
- ApiCallable.create(settings.updateSinkSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.updateSinkSettings(), this.channel, this.executor);
this.deleteSinkCallable =
- ApiCallable.create(settings.deleteSinkSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.deleteSinkSettings(), this.channel, this.executor);
if (settings.getChannelProvider().shouldAutoClose()) {
closeables.add(
@@ -207,12 +207,11 @@ public final ConfigServiceV2Settings getSettings() {
* }
*
*
- * @param parent Required. The resource name containing the sinks. Example:
+ * @param parent Required. The cloud resource containing the sinks. Example:
* `"projects/my-logging-project"`.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final PagedListResponse listSinks(
- String parent) {
+ public final ListSinksPagedResponse listSinks(String parent) {
PARENT_PATH_TEMPLATE.validate(parent, "listSinks");
ListSinksRequest request = ListSinksRequest.newBuilder().setParent(parent).build();
return listSinks(request);
@@ -239,8 +238,7 @@ public final PagedListResponse lis
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final PagedListResponse listSinks(
- ListSinksRequest request) {
+ public final ListSinksPagedResponse listSinks(ListSinksRequest request) {
return listSinksPagedCallable().call(request);
}
@@ -256,7 +254,7 @@ public final PagedListResponse lis
* ListSinksRequest request = ListSinksRequest.newBuilder()
* .setParent(formattedParent)
* .build();
- * ListenableFuture<PagedListResponse<ListSinksRequest,ListSinksResponse,LogSink>> future = configServiceV2Api.listSinksPagedCallable().futureCall(request);
+ * ListenableFuture<ListSinksPagedResponse> future = configServiceV2Api.listSinksPagedCallable().futureCall(request);
* // Do something
* for (LogSink element : future.get().iterateAllElements()) {
* // doThingsWith(element);
@@ -264,9 +262,7 @@ public final PagedListResponse lis
* }
*
*/
- public final ApiCallable<
- ListSinksRequest, PagedListResponse>
- listSinksPagedCallable() {
+ public final UnaryApiCallable listSinksPagedCallable() {
return listSinksPagedCallable;
}
@@ -297,7 +293,7 @@ public final PagedListResponse lis
* }
*
*/
- public final ApiCallable listSinksCallable() {
+ public final UnaryApiCallable listSinksCallable() {
return listSinksCallable;
}
@@ -314,7 +310,7 @@ public final ApiCallable listSinksCallable(
* }
*
*
- * @param sinkName The resource name of the sink to return. Example:
+ * @param sinkName Required. The resource name of the sink to return. Example:
* `"projects/my-project-id/sinks/my-sink-id"`.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
@@ -365,7 +361,7 @@ private final LogSink getSink(GetSinkRequest request) {
* }
*
*/
- public final ApiCallable getSinkCallable() {
+ public final UnaryApiCallable getSinkCallable() {
return getSinkCallable;
}
@@ -383,9 +379,10 @@ public final ApiCallable getSinkCallable() {
* }
*
*
- * @param parent The resource in which to create the sink. Example: `"projects/my-project-id"`.
- * The new sink must be provided in the request.
- * @param sink The new sink, which must not have an identifier that already exists.
+ * @param parent Required. The resource in which to create the sink. Example:
+ * `"projects/my-project-id"`. The new sink must be provided in the request.
+ * @param sink Required. The new sink, whose `name` parameter is a sink identifier that is not
+ * already in use.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final LogSink createSink(String parent, LogSink sink) {
@@ -440,13 +437,13 @@ public final LogSink createSink(CreateSinkRequest request) {
* }
*
*/
- public final ApiCallable createSinkCallable() {
+ public final UnaryApiCallable createSinkCallable() {
return createSinkCallable;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Creates or updates a sink.
+ * Updates or creates a sink.
*
* Sample code:
*
@@ -458,12 +455,11 @@ public final ApiCallable createSinkCallable() {
* }
*
*
- * @param sinkName The resource name of the sink to update. Example:
- * `"projects/my-project-id/sinks/my-sink-id"`.
- * The updated sink must be provided in the request and have the same name that is
- * specified in `sinkName`. If the sink does not exist, it is created.
- * @param sink The updated sink, whose name must be the same as the sink identifier in `sinkName`.
- * If `sinkName` does not exist, then this method creates a new sink.
+ * @param sinkName Required. The resource name of the sink to update, including the parent
+ * resource and the sink identifier. If the sink does not exist, this method creates the sink.
+ * Example: `"projects/my-project-id/sinks/my-sink-id"`.
+ * @param sink Required. The updated sink, whose name is the same identifier that appears as part
+ * of `sinkName`. If `sinkName` does not exist, then this method creates a new sink.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final LogSink updateSink(String sinkName, LogSink sink) {
@@ -475,7 +471,7 @@ public final LogSink updateSink(String sinkName, LogSink sink) {
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Creates or updates a sink.
+ * Updates or creates a sink.
*
*
Sample code:
*
@@ -500,7 +496,7 @@ public final LogSink updateSink(UpdateSinkRequest request) {
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Creates or updates a sink.
+ * Updates or creates a sink.
*
*
Sample code:
*
@@ -518,7 +514,7 @@ public final LogSink updateSink(UpdateSinkRequest request) {
* }
*
*/
- public final ApiCallable updateSinkCallable() {
+ public final UnaryApiCallable updateSinkCallable() {
return updateSinkCallable;
}
@@ -535,8 +531,9 @@ public final ApiCallable updateSinkCallable() {
* }
*
*
- * @param sinkName The resource name of the sink to delete. Example:
- * `"projects/my-project-id/sinks/my-sink-id"`.
+ * @param sinkName Required. The resource name of the sink to delete, including the parent
+ * resource and the sink identifier. Example: `"projects/my-project-id/sinks/my-sink-id"`. It
+ * is an error if the sink does not exist.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void deleteSink(String sinkName) {
@@ -586,7 +583,7 @@ private final void deleteSink(DeleteSinkRequest request) {
* }
*
*/
- public final ApiCallable deleteSinkCallable() {
+ public final UnaryApiCallable deleteSinkCallable() {
return deleteSinkCallable;
}
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Settings.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Settings.java
index f44dddab6743..26ab7aa3ef84 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Settings.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/ConfigServiceV2Settings.java
@@ -13,13 +13,18 @@
*/
package com.google.cloud.logging.spi.v2;
+import static com.google.cloud.logging.spi.v2.PagedResponseWrappers.ListSinksPagedResponse;
+
import com.google.api.gax.core.ConnectionSettings;
import com.google.api.gax.core.RetrySettings;
-import com.google.api.gax.grpc.ApiCallSettings;
+import com.google.api.gax.grpc.CallContext;
import com.google.api.gax.grpc.PageStreamingCallSettings;
import com.google.api.gax.grpc.PageStreamingDescriptor;
+import com.google.api.gax.grpc.PagedListResponseFactory;
import com.google.api.gax.grpc.ServiceApiSettings;
import com.google.api.gax.grpc.SimpleCallSettings;
+import com.google.api.gax.grpc.UnaryApiCallSettings;
+import com.google.api.gax.grpc.UnaryApiCallable;
import com.google.auth.Credentials;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -94,7 +99,8 @@ public class ConfigServiceV2Settings extends ServiceApiSettings {
.provideCredentialsWith(DEFAULT_SERVICE_SCOPES)
.build();
- private final PageStreamingCallSettings
+ private final PageStreamingCallSettings<
+ ListSinksRequest, ListSinksResponse, ListSinksPagedResponse>
listSinksSettings;
private final SimpleCallSettings getSinkSettings;
private final SimpleCallSettings createSinkSettings;
@@ -102,7 +108,7 @@ public class ConfigServiceV2Settings extends ServiceApiSettings {
private final SimpleCallSettings deleteSinkSettings;
/** Returns the object with the settings used for calls to listSinks. */
- public PageStreamingCallSettings
+ public PageStreamingCallSettings
listSinksSettings() {
return listSinksSettings;
}
@@ -207,11 +213,27 @@ public Iterable extractResources(ListSinksResponse payload) {
}
};
+ private static final PagedListResponseFactory<
+ ListSinksRequest, ListSinksResponse, ListSinksPagedResponse>
+ LIST_SINKS_PAGE_STR_FACT =
+ new PagedListResponseFactory<
+ ListSinksRequest, ListSinksResponse, ListSinksPagedResponse>() {
+ @Override
+ public ListSinksPagedResponse createPagedListResponse(
+ UnaryApiCallable callable,
+ ListSinksRequest request,
+ CallContext context) {
+ return new ListSinksPagedResponse(
+ callable, LIST_SINKS_PAGE_STR_DESC, request, context);
+ }
+ };
+
/** Builder for ConfigServiceV2Settings. */
public static class Builder extends ServiceApiSettings.Builder {
- private final ImmutableList methodSettingsBuilders;
+ private final ImmutableList unaryMethodSettingsBuilders;
- private final PageStreamingCallSettings.Builder
+ private final PageStreamingCallSettings.Builder<
+ ListSinksRequest, ListSinksResponse, ListSinksPagedResponse>
listSinksSettings;
private final SimpleCallSettings.Builder getSinkSettings;
private final SimpleCallSettings.Builder createSinkSettings;
@@ -254,7 +276,7 @@ private Builder() {
listSinksSettings =
PageStreamingCallSettings.newBuilder(
- ConfigServiceV2Grpc.METHOD_LIST_SINKS, LIST_SINKS_PAGE_STR_DESC);
+ ConfigServiceV2Grpc.METHOD_LIST_SINKS, LIST_SINKS_PAGE_STR_FACT);
getSinkSettings = SimpleCallSettings.newBuilder(ConfigServiceV2Grpc.METHOD_GET_SINK);
@@ -264,8 +286,8 @@ private Builder() {
deleteSinkSettings = SimpleCallSettings.newBuilder(ConfigServiceV2Grpc.METHOD_DELETE_SINK);
- methodSettingsBuilders =
- ImmutableList.of(
+ unaryMethodSettingsBuilders =
+ ImmutableList.of(
listSinksSettings,
getSinkSettings,
createSinkSettings,
@@ -313,8 +335,8 @@ private Builder(ConfigServiceV2Settings settings) {
updateSinkSettings = settings.updateSinkSettings.toBuilder();
deleteSinkSettings = settings.deleteSinkSettings.toBuilder();
- methodSettingsBuilders =
- ImmutableList.of(
+ unaryMethodSettingsBuilders =
+ ImmutableList.of(
listSinksSettings,
getSinkSettings,
createSinkSettings,
@@ -370,16 +392,20 @@ public Builder setClientLibHeader(String name, String version) {
}
/**
- * Applies the given settings to all of the API methods in this service. Only values that are
- * non-null will be applied, so this method is not capable of un-setting any values.
+ * Applies the given settings to all of the unary API methods in this service. Only values that
+ * are non-null will be applied, so this method is not capable of un-setting any values.
+ *
+ * Note: This method does not support applying settings to streaming methods.
*/
- public Builder applyToAllApiMethods(ApiCallSettings.Builder apiCallSettings) throws Exception {
- super.applyToAllApiMethods(methodSettingsBuilders, apiCallSettings);
+ public Builder applyToAllApiMethods(UnaryApiCallSettings.Builder apiCallSettings)
+ throws Exception {
+ super.applyToAllApiMethods(unaryMethodSettingsBuilders, apiCallSettings);
return this;
}
/** Returns the builder for the settings used for calls to listSinks. */
- public PageStreamingCallSettings.Builder
+ public PageStreamingCallSettings.Builder<
+ ListSinksRequest, ListSinksResponse, ListSinksPagedResponse>
listSinksSettings() {
return listSinksSettings;
}
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Api.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Api.java
index 0200b82f7d2a..7be2f99b75b6 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Api.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Api.java
@@ -13,10 +13,11 @@
*/
package com.google.cloud.logging.spi.v2;
+import static com.google.cloud.logging.spi.v2.PagedResponseWrappers.ListLogEntriesPagedResponse;
+import static com.google.cloud.logging.spi.v2.PagedResponseWrappers.ListMonitoredResourceDescriptorsPagedResponse;
+
import com.google.api.MonitoredResource;
-import com.google.api.MonitoredResourceDescriptor;
-import com.google.api.gax.core.PagedListResponse;
-import com.google.api.gax.grpc.ApiCallable;
+import com.google.api.gax.grpc.UnaryApiCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.logging.v2.DeleteLogRequest;
import com.google.logging.v2.ListLogEntriesRequest;
@@ -64,8 +65,8 @@
* A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
- * A "callable" method. This type of method takes no parameters and returns an immutable
- * ApiCallable object, which can be used to initiate calls to the service.
+ * A "callable" method. This type of method takes no parameters and returns an immutable API
+ * callable object, which can be used to initiate calls to the service.
*
*
* See the individual methods for example code.
@@ -93,22 +94,18 @@ public class LoggingServiceV2Api implements AutoCloseable {
private final ScheduledExecutorService executor;
private final List closeables = new ArrayList<>();
- private final ApiCallable deleteLogCallable;
- private final ApiCallable
+ private final UnaryApiCallable deleteLogCallable;
+ private final UnaryApiCallable
writeLogEntriesCallable;
- private final ApiCallable listLogEntriesCallable;
- private final ApiCallable<
- ListLogEntriesRequest,
- PagedListResponse>
+ private final UnaryApiCallable
+ listLogEntriesCallable;
+ private final UnaryApiCallable
listLogEntriesPagedCallable;
- private final ApiCallable<
+ private final UnaryApiCallable<
ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse>
listMonitoredResourceDescriptorsCallable;
- private final ApiCallable<
- ListMonitoredResourceDescriptorsRequest,
- PagedListResponse<
- ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse,
- MonitoredResourceDescriptor>>
+ private final UnaryApiCallable<
+ ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsPagedResponse>
listMonitoredResourceDescriptorsPagedCallable;
private static final PathTemplate PARENT_PATH_TEMPLATE =
@@ -168,19 +165,19 @@ protected LoggingServiceV2Api(LoggingServiceV2Settings settings) throws IOExcept
this.channel = settings.getChannelProvider().getOrBuildChannel(this.executor);
this.deleteLogCallable =
- ApiCallable.create(settings.deleteLogSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.deleteLogSettings(), this.channel, this.executor);
this.writeLogEntriesCallable =
- ApiCallable.create(settings.writeLogEntriesSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.writeLogEntriesSettings(), this.channel, this.executor);
this.listLogEntriesCallable =
- ApiCallable.create(settings.listLogEntriesSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.listLogEntriesSettings(), this.channel, this.executor);
this.listLogEntriesPagedCallable =
- ApiCallable.createPagedVariant(
+ UnaryApiCallable.createPagedVariant(
settings.listLogEntriesSettings(), this.channel, this.executor);
this.listMonitoredResourceDescriptorsCallable =
- ApiCallable.create(
+ UnaryApiCallable.create(
settings.listMonitoredResourceDescriptorsSettings(), this.channel, this.executor);
this.listMonitoredResourceDescriptorsPagedCallable =
- ApiCallable.createPagedVariant(
+ UnaryApiCallable.createPagedVariant(
settings.listMonitoredResourceDescriptorsSettings(), this.channel, this.executor);
if (settings.getChannelProvider().shouldAutoClose()) {
@@ -271,7 +268,7 @@ private final void deleteLog(DeleteLogRequest request) {
* }
*
*/
- public final ApiCallable deleteLogCallable() {
+ public final UnaryApiCallable deleteLogCallable() {
return deleteLogCallable;
}
@@ -291,19 +288,24 @@ public final ApiCallable deleteLogCallable() {
* }
*
*
- * @param logName Optional. A default log resource name for those log entries in `entries` that do
- * not specify their own `logName`. Example: `"projects/my-project/logs/syslog"`. See
+ * @param logName Optional. A default log resource name that is assigned to all log entries in
+ * `entries` that do not specify a value for `log_name`. Example:
+ * `"projects/my-project/logs/syslog"`. See [LogEntry][google.logging.v2.LogEntry].
+ * @param resource Optional. A default monitored resource object that is assigned to all log
+ * entries in `entries` that do not specify a value for `resource`. Example:
+ * { "type": "gce_instance", "labels": { "zone": "us-central1-a", "instance_id":
+ * "00000000000000000000" }}
+ *
See [LogEntry][google.logging.v2.LogEntry].
+ * @param labels Optional. Default labels that are added to the `labels` field of all log entries
+ * in `entries`. If a log entry already has a label with the same key as a label in this
+ * parameter, then the log entry's label is not changed. See
* [LogEntry][google.logging.v2.LogEntry].
- * @param resource Optional. A default monitored resource for those log entries in `entries` that
- * do not specify their own `resource`.
- * @param labels Optional. User-defined `key:value` items that are added to the `labels` field of
- * each log entry in `entries`, except when a log entry specifies its own `key:value` item
- * with the same key. Example: `{ "size": "large", "color":"red" }`
- * @param entries Required. The log entries to write. The log entries must have values for all
- * required fields.
- *
To improve throughput and to avoid exceeding the quota limit for calls to
- * `entries.write`, use this field to write multiple log entries at once rather than //
- * calling this method for each log entry.
+ * @param entries Required. The log entries to write. Values supplied for the fields `log_name`,
+ * `resource`, and `labels` in this `entries.write` request are added to those log entries
+ * that do not provide their own values for the fields.
+ *
To improve throughput and to avoid exceeding the [quota limit](/logging/quota-policy)
+ * for calls to `entries.write`, you should write multiple log entries at once rather than
+ * calling this method for each individual log entry.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final WriteLogEntriesResponse writeLogEntries(
@@ -365,7 +367,7 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
* }
*
*/
- public final ApiCallable
+ public final UnaryApiCallable
writeLogEntriesCallable() {
return writeLogEntriesCallable;
}
@@ -388,11 +390,13 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
* }
*
*
- * @param projectIds Required. One or more project IDs or project numbers from which to retrieve
- * log entries. Examples of a project ID: `"my-project-1A"`, `"1234567890"`.
- * @param filter Optional. An [advanced logs filter](/logging/docs/view/advanced_filters). The
- * filter is compared against all log entries in the projects specified by `projectIds`. Only
- * entries that match the filter are retrieved. An empty filter matches all log entries.
+ * @param projectIds Deprecated. One or more project identifiers or project numbers from which to
+ * retrieve log entries. Examples: `"my-project-1A"`, `"1234567890"`. If present, these
+ * project identifiers are converted to resource format and added to the list of resources in
+ * `resourceNames`. Callers should use `resourceNames` rather than this parameter.
+ * @param filter Optional. A filter that chooses which log entries to return. See [Advanced Logs
+ * Filters](/logging/docs/view/advanced_filters). Only log entries that match the filter are
+ * returned. An empty filter matches all log entries.
* @param orderBy Optional. How the results should be sorted. Presently, the only permitted values
* are `"timestamp asc"` (default) and `"timestamp desc"`. The first option returns entries in
* order of increasing values of `LogEntry.timestamp` (oldest first), and the second option
@@ -400,8 +404,8 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
* timestamps are returned in order of `LogEntry.insertId`.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final PagedListResponse
- listLogEntries(List projectIds, String filter, String orderBy) {
+ public final ListLogEntriesPagedResponse listLogEntries(
+ List projectIds, String filter, String orderBy) {
ListLogEntriesRequest request =
ListLogEntriesRequest.newBuilder()
.addAllProjectIds(projectIds)
@@ -433,8 +437,7 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final PagedListResponse
- listLogEntries(ListLogEntriesRequest request) {
+ public final ListLogEntriesPagedResponse listLogEntries(ListLogEntriesRequest request) {
return listLogEntriesPagedCallable().call(request);
}
@@ -451,7 +454,7 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
* ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder()
* .addAllProjectIds(projectIds)
* .build();
- * ListenableFuture<PagedListResponse<ListLogEntriesRequest,ListLogEntriesResponse,LogEntry>> future = loggingServiceV2Api.listLogEntriesPagedCallable().futureCall(request);
+ * ListenableFuture<ListLogEntriesPagedResponse> future = loggingServiceV2Api.listLogEntriesPagedCallable().futureCall(request);
* // Do something
* for (LogEntry element : future.get().iterateAllElements()) {
* // doThingsWith(element);
@@ -459,9 +462,7 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
* }
*
*/
- public final ApiCallable<
- ListLogEntriesRequest,
- PagedListResponse>
+ public final UnaryApiCallable
listLogEntriesPagedCallable() {
return listLogEntriesPagedCallable;
}
@@ -494,7 +495,8 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
* }
*
*/
- public final ApiCallable listLogEntriesCallable() {
+ public final UnaryApiCallable
+ listLogEntriesCallable() {
return listLogEntriesCallable;
}
@@ -516,10 +518,8 @@ public final ApiCallable listLogE
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final PagedListResponse<
- ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse,
- MonitoredResourceDescriptor>
- listMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest request) {
+ public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResourceDescriptors(
+ ListMonitoredResourceDescriptorsRequest request) {
return listMonitoredResourceDescriptorsPagedCallable().call(request);
}
@@ -532,7 +532,7 @@ public final ApiCallable listLogE
*
* try (LoggingServiceV2Api loggingServiceV2Api = LoggingServiceV2Api.create()) {
* ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder().build();
- * ListenableFuture<PagedListResponse<ListMonitoredResourceDescriptorsRequest,ListMonitoredResourceDescriptorsResponse,MonitoredResourceDescriptor>> future = loggingServiceV2Api.listMonitoredResourceDescriptorsPagedCallable().futureCall(request);
+ * ListenableFuture<ListMonitoredResourceDescriptorsPagedResponse> future = loggingServiceV2Api.listMonitoredResourceDescriptorsPagedCallable().futureCall(request);
* // Do something
* for (MonitoredResourceDescriptor element : future.get().iterateAllElements()) {
* // doThingsWith(element);
@@ -540,11 +540,8 @@ public final ApiCallable listLogE
* }
*
*/
- public final ApiCallable<
- ListMonitoredResourceDescriptorsRequest,
- PagedListResponse<
- ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse,
- MonitoredResourceDescriptor>>
+ public final UnaryApiCallable<
+ ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsPagedResponse>
listMonitoredResourceDescriptorsPagedCallable() {
return listMonitoredResourceDescriptorsPagedCallable;
}
@@ -573,7 +570,7 @@ public final ApiCallable listLogE
* }
*
*/
- public final ApiCallable<
+ public final UnaryApiCallable<
ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse>
listMonitoredResourceDescriptorsCallable() {
return listMonitoredResourceDescriptorsCallable;
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Settings.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Settings.java
index 3db49f10b4f0..5e3e5ab115a7 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Settings.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingServiceV2Settings.java
@@ -13,14 +13,20 @@
*/
package com.google.cloud.logging.spi.v2;
+import static com.google.cloud.logging.spi.v2.PagedResponseWrappers.ListLogEntriesPagedResponse;
+import static com.google.cloud.logging.spi.v2.PagedResponseWrappers.ListMonitoredResourceDescriptorsPagedResponse;
+
import com.google.api.MonitoredResourceDescriptor;
import com.google.api.gax.core.ConnectionSettings;
import com.google.api.gax.core.RetrySettings;
-import com.google.api.gax.grpc.ApiCallSettings;
+import com.google.api.gax.grpc.CallContext;
import com.google.api.gax.grpc.PageStreamingCallSettings;
import com.google.api.gax.grpc.PageStreamingDescriptor;
+import com.google.api.gax.grpc.PagedListResponseFactory;
import com.google.api.gax.grpc.ServiceApiSettings;
import com.google.api.gax.grpc.SimpleCallSettings;
+import com.google.api.gax.grpc.UnaryApiCallSettings;
+import com.google.api.gax.grpc.UnaryApiCallable;
import com.google.auth.Credentials;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -99,11 +105,12 @@ public class LoggingServiceV2Settings extends ServiceApiSettings {
private final SimpleCallSettings deleteLogSettings;
private final SimpleCallSettings
writeLogEntriesSettings;
- private final PageStreamingCallSettings
+ private final PageStreamingCallSettings<
+ ListLogEntriesRequest, ListLogEntriesResponse, ListLogEntriesPagedResponse>
listLogEntriesSettings;
private final PageStreamingCallSettings<
ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse,
- MonitoredResourceDescriptor>
+ ListMonitoredResourceDescriptorsPagedResponse>
listMonitoredResourceDescriptorsSettings;
/** Returns the object with the settings used for calls to deleteLog. */
@@ -118,7 +125,8 @@ public SimpleCallSettings deleteLogSettings() {
}
/** Returns the object with the settings used for calls to listLogEntries. */
- public PageStreamingCallSettings
+ public PageStreamingCallSettings<
+ ListLogEntriesRequest, ListLogEntriesResponse, ListLogEntriesPagedResponse>
listLogEntriesSettings() {
return listLogEntriesSettings;
}
@@ -126,7 +134,7 @@ public SimpleCallSettings deleteLogSettings() {
/** Returns the object with the settings used for calls to listMonitoredResourceDescriptors. */
public PageStreamingCallSettings<
ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse,
- MonitoredResourceDescriptor>
+ ListMonitoredResourceDescriptorsPagedResponse>
listMonitoredResourceDescriptorsSettings() {
return listMonitoredResourceDescriptorsSettings;
}
@@ -258,19 +266,54 @@ public Iterable extractResources(
}
};
+ private static final PagedListResponseFactory<
+ ListLogEntriesRequest, ListLogEntriesResponse, ListLogEntriesPagedResponse>
+ LIST_LOG_ENTRIES_PAGE_STR_FACT =
+ new PagedListResponseFactory<
+ ListLogEntriesRequest, ListLogEntriesResponse, ListLogEntriesPagedResponse>() {
+ @Override
+ public ListLogEntriesPagedResponse createPagedListResponse(
+ UnaryApiCallable callable,
+ ListLogEntriesRequest request,
+ CallContext context) {
+ return new ListLogEntriesPagedResponse(
+ callable, LIST_LOG_ENTRIES_PAGE_STR_DESC, request, context);
+ }
+ };
+
+ private static final PagedListResponseFactory<
+ ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse,
+ ListMonitoredResourceDescriptorsPagedResponse>
+ LIST_MONITORED_RESOURCE_DESCRIPTORS_PAGE_STR_FACT =
+ new PagedListResponseFactory<
+ ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse,
+ ListMonitoredResourceDescriptorsPagedResponse>() {
+ @Override
+ public ListMonitoredResourceDescriptorsPagedResponse createPagedListResponse(
+ UnaryApiCallable<
+ ListMonitoredResourceDescriptorsRequest,
+ ListMonitoredResourceDescriptorsResponse>
+ callable,
+ ListMonitoredResourceDescriptorsRequest request,
+ CallContext context) {
+ return new ListMonitoredResourceDescriptorsPagedResponse(
+ callable, LIST_MONITORED_RESOURCE_DESCRIPTORS_PAGE_STR_DESC, request, context);
+ }
+ };
+
/** Builder for LoggingServiceV2Settings. */
public static class Builder extends ServiceApiSettings.Builder {
- private final ImmutableList methodSettingsBuilders;
+ private final ImmutableList unaryMethodSettingsBuilders;
private final SimpleCallSettings.Builder deleteLogSettings;
private final SimpleCallSettings.Builder
writeLogEntriesSettings;
private final PageStreamingCallSettings.Builder<
- ListLogEntriesRequest, ListLogEntriesResponse, LogEntry>
+ ListLogEntriesRequest, ListLogEntriesResponse, ListLogEntriesPagedResponse>
listLogEntriesSettings;
private final PageStreamingCallSettings.Builder<
ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse,
- MonitoredResourceDescriptor>
+ ListMonitoredResourceDescriptorsPagedResponse>
listMonitoredResourceDescriptorsSettings;
private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS;
@@ -324,15 +367,15 @@ private Builder() {
listLogEntriesSettings =
PageStreamingCallSettings.newBuilder(
- LoggingServiceV2Grpc.METHOD_LIST_LOG_ENTRIES, LIST_LOG_ENTRIES_PAGE_STR_DESC);
+ LoggingServiceV2Grpc.METHOD_LIST_LOG_ENTRIES, LIST_LOG_ENTRIES_PAGE_STR_FACT);
listMonitoredResourceDescriptorsSettings =
PageStreamingCallSettings.newBuilder(
LoggingServiceV2Grpc.METHOD_LIST_MONITORED_RESOURCE_DESCRIPTORS,
- LIST_MONITORED_RESOURCE_DESCRIPTORS_PAGE_STR_DESC);
+ LIST_MONITORED_RESOURCE_DESCRIPTORS_PAGE_STR_FACT);
- methodSettingsBuilders =
- ImmutableList.of(
+ unaryMethodSettingsBuilders =
+ ImmutableList.of(
deleteLogSettings,
writeLogEntriesSettings,
listLogEntriesSettings,
@@ -374,8 +417,8 @@ private Builder(LoggingServiceV2Settings settings) {
listMonitoredResourceDescriptorsSettings =
settings.listMonitoredResourceDescriptorsSettings.toBuilder();
- methodSettingsBuilders =
- ImmutableList.of(
+ unaryMethodSettingsBuilders =
+ ImmutableList.of(
deleteLogSettings,
writeLogEntriesSettings,
listLogEntriesSettings,
@@ -430,11 +473,14 @@ public Builder setClientLibHeader(String name, String version) {
}
/**
- * Applies the given settings to all of the API methods in this service. Only values that are
- * non-null will be applied, so this method is not capable of un-setting any values.
+ * Applies the given settings to all of the unary API methods in this service. Only values that
+ * are non-null will be applied, so this method is not capable of un-setting any values.
+ *
+ * Note: This method does not support applying settings to streaming methods.
*/
- public Builder applyToAllApiMethods(ApiCallSettings.Builder apiCallSettings) throws Exception {
- super.applyToAllApiMethods(methodSettingsBuilders, apiCallSettings);
+ public Builder applyToAllApiMethods(UnaryApiCallSettings.Builder apiCallSettings)
+ throws Exception {
+ super.applyToAllApiMethods(unaryMethodSettingsBuilders, apiCallSettings);
return this;
}
@@ -451,7 +497,7 @@ public SimpleCallSettings.Builder deleteLogSettings() {
/** Returns the builder for the settings used for calls to listLogEntries. */
public PageStreamingCallSettings.Builder<
- ListLogEntriesRequest, ListLogEntriesResponse, LogEntry>
+ ListLogEntriesRequest, ListLogEntriesResponse, ListLogEntriesPagedResponse>
listLogEntriesSettings() {
return listLogEntriesSettings;
}
@@ -459,7 +505,7 @@ public SimpleCallSettings.Builder deleteLogSettings() {
/** Returns the builder for the settings used for calls to listMonitoredResourceDescriptors. */
public PageStreamingCallSettings.Builder<
ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse,
- MonitoredResourceDescriptor>
+ ListMonitoredResourceDescriptorsPagedResponse>
listMonitoredResourceDescriptorsSettings() {
return listMonitoredResourceDescriptorsSettings;
}
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Api.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Api.java
index e458ba1c756e..90303869b5a7 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Api.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Api.java
@@ -13,8 +13,9 @@
*/
package com.google.cloud.logging.spi.v2;
-import com.google.api.gax.core.PagedListResponse;
-import com.google.api.gax.grpc.ApiCallable;
+import static com.google.cloud.logging.spi.v2.PagedResponseWrappers.ListLogMetricsPagedResponse;
+
+import com.google.api.gax.grpc.UnaryApiCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.logging.v2.CreateLogMetricRequest;
import com.google.logging.v2.DeleteLogMetricRequest;
@@ -60,8 +61,8 @@
* A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
- * A "callable" method. This type of method takes no parameters and returns an immutable
- * ApiCallable object, which can be used to initiate calls to the service.
+ * A "callable" method. This type of method takes no parameters and returns an immutable API
+ * callable object, which can be used to initiate calls to the service.
*
*
* See the individual methods for example code.
@@ -89,15 +90,14 @@ public class MetricsServiceV2Api implements AutoCloseable {
private final ScheduledExecutorService executor;
private final List closeables = new ArrayList<>();
- private final ApiCallable listLogMetricsCallable;
- private final ApiCallable<
- ListLogMetricsRequest,
- PagedListResponse>
+ private final UnaryApiCallable
+ listLogMetricsCallable;
+ private final UnaryApiCallable
listLogMetricsPagedCallable;
- private final ApiCallable getLogMetricCallable;
- private final ApiCallable createLogMetricCallable;
- private final ApiCallable updateLogMetricCallable;
- private final ApiCallable deleteLogMetricCallable;
+ private final UnaryApiCallable getLogMetricCallable;
+ private final UnaryApiCallable createLogMetricCallable;
+ private final UnaryApiCallable updateLogMetricCallable;
+ private final UnaryApiCallable deleteLogMetricCallable;
private static final PathTemplate PARENT_PATH_TEMPLATE =
PathTemplate.createWithoutUrlEncoding("projects/{project}");
@@ -156,18 +156,18 @@ protected MetricsServiceV2Api(MetricsServiceV2Settings settings) throws IOExcept
this.channel = settings.getChannelProvider().getOrBuildChannel(this.executor);
this.listLogMetricsCallable =
- ApiCallable.create(settings.listLogMetricsSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.listLogMetricsSettings(), this.channel, this.executor);
this.listLogMetricsPagedCallable =
- ApiCallable.createPagedVariant(
+ UnaryApiCallable.createPagedVariant(
settings.listLogMetricsSettings(), this.channel, this.executor);
this.getLogMetricCallable =
- ApiCallable.create(settings.getLogMetricSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.getLogMetricSettings(), this.channel, this.executor);
this.createLogMetricCallable =
- ApiCallable.create(settings.createLogMetricSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.createLogMetricSettings(), this.channel, this.executor);
this.updateLogMetricCallable =
- ApiCallable.create(settings.updateLogMetricSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.updateLogMetricSettings(), this.channel, this.executor);
this.deleteLogMetricCallable =
- ApiCallable.create(settings.deleteLogMetricSettings(), this.channel, this.executor);
+ UnaryApiCallable.create(settings.deleteLogMetricSettings(), this.channel, this.executor);
if (settings.getChannelProvider().shouldAutoClose()) {
closeables.add(
@@ -212,8 +212,7 @@ public final MetricsServiceV2Settings getSettings() {
* `"projects/my-project-id"`.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final PagedListResponse
- listLogMetrics(String parent) {
+ public final ListLogMetricsPagedResponse listLogMetrics(String parent) {
PARENT_PATH_TEMPLATE.validate(parent, "listLogMetrics");
ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder().setParent(parent).build();
return listLogMetrics(request);
@@ -240,8 +239,7 @@ public final MetricsServiceV2Settings getSettings() {
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final PagedListResponse
- listLogMetrics(ListLogMetricsRequest request) {
+ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest request) {
return listLogMetricsPagedCallable().call(request);
}
@@ -257,7 +255,7 @@ public final MetricsServiceV2Settings getSettings() {
* ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder()
* .setParent(formattedParent)
* .build();
- * ListenableFuture<PagedListResponse<ListLogMetricsRequest,ListLogMetricsResponse,LogMetric>> future = metricsServiceV2Api.listLogMetricsPagedCallable().futureCall(request);
+ * ListenableFuture<ListLogMetricsPagedResponse> future = metricsServiceV2Api.listLogMetricsPagedCallable().futureCall(request);
* // Do something
* for (LogMetric element : future.get().iterateAllElements()) {
* // doThingsWith(element);
@@ -265,9 +263,7 @@ public final MetricsServiceV2Settings getSettings() {
* }
*
*/
- public final ApiCallable<
- ListLogMetricsRequest,
- PagedListResponse>
+ public final UnaryApiCallable
listLogMetricsPagedCallable() {
return listLogMetricsPagedCallable;
}
@@ -299,7 +295,8 @@ public final MetricsServiceV2Settings getSettings() {
* }
*
*/
- public final ApiCallable listLogMetricsCallable() {
+ public final UnaryApiCallable
+ listLogMetricsCallable() {
return listLogMetricsCallable;
}
@@ -368,7 +365,7 @@ private final LogMetric getLogMetric(GetLogMetricRequest request) {
* }
*
*/
- public final ApiCallable getLogMetricCallable() {
+ public final UnaryApiCallable getLogMetricCallable() {
return getLogMetricCallable;
}
@@ -444,7 +441,7 @@ public final LogMetric createLogMetric(CreateLogMetricRequest request) {
* }
*
*/
- public final ApiCallable createLogMetricCallable() {
+ public final UnaryApiCallable createLogMetricCallable() {
return createLogMetricCallable;
}
@@ -522,7 +519,7 @@ public final LogMetric updateLogMetric(UpdateLogMetricRequest request) {
* }
*
*/
- public final ApiCallable updateLogMetricCallable() {
+ public final UnaryApiCallable updateLogMetricCallable() {
return updateLogMetricCallable;
}
@@ -591,7 +588,7 @@ private final void deleteLogMetric(DeleteLogMetricRequest request) {
* }
*
*/
- public final ApiCallable deleteLogMetricCallable() {
+ public final UnaryApiCallable deleteLogMetricCallable() {
return deleteLogMetricCallable;
}
diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Settings.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Settings.java
index 33302e500c2f..a59f5e3fe76a 100644
--- a/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Settings.java
+++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/MetricsServiceV2Settings.java
@@ -13,13 +13,18 @@
*/
package com.google.cloud.logging.spi.v2;
+import static com.google.cloud.logging.spi.v2.PagedResponseWrappers.ListLogMetricsPagedResponse;
+
import com.google.api.gax.core.ConnectionSettings;
import com.google.api.gax.core.RetrySettings;
-import com.google.api.gax.grpc.ApiCallSettings;
+import com.google.api.gax.grpc.CallContext;
import com.google.api.gax.grpc.PageStreamingCallSettings;
import com.google.api.gax.grpc.PageStreamingDescriptor;
+import com.google.api.gax.grpc.PagedListResponseFactory;
import com.google.api.gax.grpc.ServiceApiSettings;
import com.google.api.gax.grpc.SimpleCallSettings;
+import com.google.api.gax.grpc.UnaryApiCallSettings;
+import com.google.api.gax.grpc.UnaryApiCallable;
import com.google.auth.Credentials;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -94,7 +99,8 @@ public class MetricsServiceV2Settings extends ServiceApiSettings {
.provideCredentialsWith(DEFAULT_SERVICE_SCOPES)
.build();
- private final PageStreamingCallSettings