diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorGroupServiceClient.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorGroupServiceClient.java
index 52c8b587..b2b3eb6a 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorGroupServiceClient.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorGroupServiceClient.java
@@ -92,6 +92,21 @@
* ErrorGroupServiceClient.create(errorGroupServiceSettings);
* }
*
+ * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ErrorGroupServiceSettings errorGroupServiceSettings =
+ * ErrorGroupServiceSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * ErrorGroupServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * ErrorGroupServiceClient errorGroupServiceClient =
+ * ErrorGroupServiceClient.create(errorGroupServiceSettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@BetaApi
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorGroupServiceSettings.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorGroupServiceSettings.java
index ff857e46..210872a9 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorGroupServiceSettings.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorGroupServiceSettings.java
@@ -21,6 +21,7 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
@@ -105,11 +106,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return ErrorGroupServiceStubSettings.defaultCredentialsProviderBuilder();
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return ErrorGroupServiceStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return ErrorGroupServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return ErrorGroupServiceStubSettings.defaultTransportChannelProvider();
}
@@ -119,11 +127,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return ErrorGroupServiceStubSettings.defaultApiClientHeaderProviderBuilder();
}
- /** Returns a new builder for this class. */
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ @BetaApi
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -161,6 +175,11 @@ private static Builder createDefault() {
return new Builder(ErrorGroupServiceStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(ErrorGroupServiceStubSettings.newHttpJsonBuilder());
+ }
+
public ErrorGroupServiceStubSettings.Builder getStubSettingsBuilder() {
return ((ErrorGroupServiceStubSettings.Builder) getStubSettings());
}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
index 95731630..a795d06e 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
@@ -101,6 +101,21 @@
* ErrorStatsServiceClient.create(errorStatsServiceSettings);
* }
*
+ *
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ErrorStatsServiceSettings errorStatsServiceSettings =
+ * ErrorStatsServiceSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * ErrorStatsServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * ErrorStatsServiceClient errorStatsServiceClient =
+ * ErrorStatsServiceClient.create(errorStatsServiceSettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@BetaApi
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceSettings.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceSettings.java
index 14c6736a..7c0fbbfb 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceSettings.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceSettings.java
@@ -24,6 +24,7 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
@@ -117,11 +118,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return ErrorStatsServiceStubSettings.defaultCredentialsProviderBuilder();
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return ErrorStatsServiceStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return ErrorStatsServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return ErrorStatsServiceStubSettings.defaultTransportChannelProvider();
}
@@ -131,11 +139,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return ErrorStatsServiceStubSettings.defaultApiClientHeaderProviderBuilder();
}
- /** Returns a new builder for this class. */
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ @BetaApi
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -173,6 +187,11 @@ private static Builder createDefault() {
return new Builder(ErrorStatsServiceStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(ErrorStatsServiceStubSettings.newHttpJsonBuilder());
+ }
+
public ErrorStatsServiceStubSettings.Builder getStubSettingsBuilder() {
return ((ErrorStatsServiceStubSettings.Builder) getStubSettings());
}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ReportErrorsServiceClient.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ReportErrorsServiceClient.java
index 2c8bedd8..af2022ca 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ReportErrorsServiceClient.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ReportErrorsServiceClient.java
@@ -94,6 +94,21 @@
* ReportErrorsServiceClient.create(reportErrorsServiceSettings);
* }
*
+ *
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ReportErrorsServiceSettings reportErrorsServiceSettings =
+ * ReportErrorsServiceSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * ReportErrorsServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * ReportErrorsServiceClient reportErrorsServiceClient =
+ * ReportErrorsServiceClient.create(reportErrorsServiceSettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@BetaApi
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ReportErrorsServiceSettings.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ReportErrorsServiceSettings.java
index 9665e5a0..a8b727d9 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ReportErrorsServiceSettings.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ReportErrorsServiceSettings.java
@@ -21,6 +21,7 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
@@ -102,11 +103,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return ReportErrorsServiceStubSettings.defaultCredentialsProviderBuilder();
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return ReportErrorsServiceStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return ReportErrorsServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return ReportErrorsServiceStubSettings.defaultTransportChannelProvider();
}
@@ -116,11 +124,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return ReportErrorsServiceStubSettings.defaultApiClientHeaderProviderBuilder();
}
- /** Returns a new builder for this class. */
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ @BetaApi
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -158,6 +172,11 @@ private static Builder createDefault() {
return new Builder(ReportErrorsServiceStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(ReportErrorsServiceStubSettings.newHttpJsonBuilder());
+ }
+
public ReportErrorsServiceStubSettings.Builder getStubSettingsBuilder() {
return ((ReportErrorsServiceStubSettings.Builder) getStubSettings());
}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/ErrorGroupServiceStubSettings.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/ErrorGroupServiceStubSettings.java
index d7234ed2..b3a30c64 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/ErrorGroupServiceStubSettings.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/ErrorGroupServiceStubSettings.java
@@ -24,6 +24,9 @@
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
@@ -105,6 +108,11 @@ public ErrorGroupServiceStub createStub() throws IOException {
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcErrorGroupServiceStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonErrorGroupServiceStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -137,18 +145,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
.setUseJwtAccessWithScope(true);
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
- public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(ErrorGroupServiceStubSettings.class))
@@ -156,11 +171,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
- /** Returns a new builder for this class. */
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(ErrorGroupServiceStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return ErrorGroupServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -254,6 +288,19 @@ private static Builder createDefault() {
return initDefaults(builder);
}
+ private static Builder createHttpJsonDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
private static Builder initDefaults(Builder builder) {
builder
.getGroupSettings()
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/ErrorStatsServiceStubSettings.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/ErrorStatsServiceStubSettings.java
index e25e702b..023cd12e 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/ErrorStatsServiceStubSettings.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/ErrorStatsServiceStubSettings.java
@@ -28,6 +28,9 @@
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.ApiCallContext;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
@@ -243,6 +246,11 @@ public ErrorStatsServiceStub createStub() throws IOException {
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcErrorStatsServiceStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonErrorStatsServiceStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -275,18 +283,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
.setUseJwtAccessWithScope(true);
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
- public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(ErrorStatsServiceStubSettings.class))
@@ -294,11 +309,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
- /** Returns a new builder for this class. */
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(ErrorStatsServiceStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return ErrorStatsServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -403,6 +437,19 @@ private static Builder createDefault() {
return initDefaults(builder);
}
+ private static Builder createHttpJsonDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
private static Builder initDefaults(Builder builder) {
builder
.listGroupStatsSettings()
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonErrorGroupServiceCallableFactory.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonErrorGroupServiceCallableFactory.java
new file mode 100644
index 00000000..961d2b48
--- /dev/null
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonErrorGroupServiceCallableFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2022 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.devtools.clouderrorreporting.v1beta1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the ErrorGroupService service API.
+ *
+ *
This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonErrorGroupServiceCallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonErrorGroupServiceStub.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonErrorGroupServiceStub.java
new file mode 100644
index 00000000..8ebecaf2
--- /dev/null
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonErrorGroupServiceStub.java
@@ -0,0 +1,244 @@
+/*
+ * Copyright 2022 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.devtools.clouderrorreporting.v1beta1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.core.InternalApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.httpjson.ApiMethodDescriptor;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
+import com.google.api.gax.httpjson.ProtoMessageResponseParser;
+import com.google.api.gax.httpjson.ProtoRestSerializer;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroup;
+import com.google.devtools.clouderrorreporting.v1beta1.GetGroupRequest;
+import com.google.devtools.clouderrorreporting.v1beta1.UpdateGroupRequest;
+import com.google.protobuf.TypeRegistry;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the ErrorGroupService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonErrorGroupServiceStub extends ErrorGroupServiceStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor getGroupMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.devtools.clouderrorreporting.v1beta1.ErrorGroupService/GetGroup")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta1/{groupName=projects/*/groups/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "groupName", request.getGroupName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ErrorGroup.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateGroupMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.devtools.clouderrorreporting.v1beta1.ErrorGroupService/UpdateGroup")
+ .setHttpMethod("PUT")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta1/{group.name=projects/*/groups/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields, "group.name", request.getGroup().getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create().toBody("group", request.getGroup()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ErrorGroup.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable getGroupCallable;
+ private final UnaryCallable updateGroupCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonErrorGroupServiceStub create(ErrorGroupServiceStubSettings settings)
+ throws IOException {
+ return new HttpJsonErrorGroupServiceStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonErrorGroupServiceStub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonErrorGroupServiceStub(
+ ErrorGroupServiceStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonErrorGroupServiceStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonErrorGroupServiceStub(
+ ErrorGroupServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonErrorGroupServiceStub, using the given settings. This is
+ * protected so that it is easy to make a subclass, but otherwise, the static factory methods
+ * should be preferred.
+ */
+ protected HttpJsonErrorGroupServiceStub(
+ ErrorGroupServiceStubSettings settings, ClientContext clientContext) throws IOException {
+ this(settings, clientContext, new HttpJsonErrorGroupServiceCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonErrorGroupServiceStub, using the given settings. This is
+ * protected so that it is easy to make a subclass, but otherwise, the static factory methods
+ * should be preferred.
+ */
+ protected HttpJsonErrorGroupServiceStub(
+ ErrorGroupServiceStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+
+ HttpJsonCallSettings getGroupTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getGroupMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings updateGroupTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(updateGroupMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+
+ this.getGroupCallable =
+ callableFactory.createUnaryCallable(
+ getGroupTransportSettings, settings.getGroupSettings(), clientContext);
+ this.updateGroupCallable =
+ callableFactory.createUnaryCallable(
+ updateGroupTransportSettings, settings.updateGroupSettings(), clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(getGroupMethodDescriptor);
+ methodDescriptors.add(updateGroupMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ @Override
+ public UnaryCallable getGroupCallable() {
+ return getGroupCallable;
+ }
+
+ @Override
+ public UnaryCallable updateGroupCallable() {
+ return updateGroupCallable;
+ }
+
+ @Override
+ public final void close() {
+ try {
+ backgroundResources.close();
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to close resource", e);
+ }
+ }
+
+ @Override
+ public void shutdown() {
+ backgroundResources.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return backgroundResources.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return backgroundResources.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ backgroundResources.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return backgroundResources.awaitTermination(duration, unit);
+ }
+}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonErrorStatsServiceCallableFactory.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonErrorStatsServiceCallableFactory.java
new file mode 100644
index 00000000..4a79f696
--- /dev/null
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonErrorStatsServiceCallableFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2022 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.devtools.clouderrorreporting.v1beta1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the ErrorStatsService service API.
+ *
+ * This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonErrorStatsServiceCallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonErrorStatsServiceStub.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonErrorStatsServiceStub.java
new file mode 100644
index 00000000..34e3f493
--- /dev/null
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonErrorStatsServiceStub.java
@@ -0,0 +1,339 @@
+/*
+ * Copyright 2022 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.devtools.clouderrorreporting.v1beta1.stub;
+
+import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListEventsPagedResponse;
+import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListGroupStatsPagedResponse;
+
+import com.google.api.core.BetaApi;
+import com.google.api.core.InternalApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.httpjson.ApiMethodDescriptor;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
+import com.google.api.gax.httpjson.ProtoMessageResponseParser;
+import com.google.api.gax.httpjson.ProtoRestSerializer;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest;
+import com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse;
+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;
+import com.google.protobuf.TypeRegistry;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the ErrorStatsService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonErrorStatsServiceStub extends ErrorStatsServiceStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor
+ listGroupStatsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/ListGroupStats")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta1/{projectName=projects/*}/groupStats",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields, "projectName", request.getProjectName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "alignment", request.getAlignment());
+ serializer.putQueryParam(
+ fields, "alignmentTime", request.getAlignmentTime());
+ serializer.putQueryParam(fields, "groupId", request.getGroupIdList());
+ serializer.putQueryParam(fields, "order", request.getOrder());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ serializer.putQueryParam(
+ fields, "serviceFilter", request.getServiceFilter());
+ serializer.putQueryParam(fields, "timeRange", request.getTimeRange());
+ serializer.putQueryParam(
+ fields, "timedCountDuration", request.getTimedCountDuration());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListGroupStatsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ listEventsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/ListEvents")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta1/{projectName=projects/*}/events",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields, "projectName", request.getProjectName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "groupId", request.getGroupId());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ serializer.putQueryParam(
+ fields, "serviceFilter", request.getServiceFilter());
+ serializer.putQueryParam(fields, "timeRange", request.getTimeRange());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListEventsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ deleteEventsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.devtools.clouderrorreporting.v1beta1.ErrorStatsService/DeleteEvents")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta1/{projectName=projects/*}/events",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields, "projectName", request.getProjectName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(DeleteEventsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable listGroupStatsCallable;
+ private final UnaryCallable
+ listGroupStatsPagedCallable;
+ private final UnaryCallable listEventsCallable;
+ private final UnaryCallable listEventsPagedCallable;
+ private final UnaryCallable deleteEventsCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonErrorStatsServiceStub create(ErrorStatsServiceStubSettings settings)
+ throws IOException {
+ return new HttpJsonErrorStatsServiceStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonErrorStatsServiceStub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonErrorStatsServiceStub(
+ ErrorStatsServiceStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonErrorStatsServiceStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonErrorStatsServiceStub(
+ ErrorStatsServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonErrorStatsServiceStub, using the given settings. This is
+ * protected so that it is easy to make a subclass, but otherwise, the static factory methods
+ * should be preferred.
+ */
+ protected HttpJsonErrorStatsServiceStub(
+ ErrorStatsServiceStubSettings settings, ClientContext clientContext) throws IOException {
+ this(settings, clientContext, new HttpJsonErrorStatsServiceCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonErrorStatsServiceStub, using the given settings. This is
+ * protected so that it is easy to make a subclass, but otherwise, the static factory methods
+ * should be preferred.
+ */
+ protected HttpJsonErrorStatsServiceStub(
+ ErrorStatsServiceStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+
+ HttpJsonCallSettings
+ listGroupStatsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listGroupStatsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings listEventsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listEventsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings deleteEventsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(deleteEventsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+
+ this.listGroupStatsCallable =
+ callableFactory.createUnaryCallable(
+ listGroupStatsTransportSettings, settings.listGroupStatsSettings(), clientContext);
+ this.listGroupStatsPagedCallable =
+ callableFactory.createPagedCallable(
+ listGroupStatsTransportSettings, settings.listGroupStatsSettings(), clientContext);
+ this.listEventsCallable =
+ callableFactory.createUnaryCallable(
+ listEventsTransportSettings, settings.listEventsSettings(), clientContext);
+ this.listEventsPagedCallable =
+ callableFactory.createPagedCallable(
+ listEventsTransportSettings, settings.listEventsSettings(), clientContext);
+ this.deleteEventsCallable =
+ callableFactory.createUnaryCallable(
+ deleteEventsTransportSettings, settings.deleteEventsSettings(), clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(listGroupStatsMethodDescriptor);
+ methodDescriptors.add(listEventsMethodDescriptor);
+ methodDescriptors.add(deleteEventsMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ @Override
+ public UnaryCallable listGroupStatsCallable() {
+ return listGroupStatsCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listGroupStatsPagedCallable() {
+ return listGroupStatsPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable listEventsCallable() {
+ return listEventsCallable;
+ }
+
+ @Override
+ public UnaryCallable listEventsPagedCallable() {
+ return listEventsPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable deleteEventsCallable() {
+ return deleteEventsCallable;
+ }
+
+ @Override
+ public final void close() {
+ try {
+ backgroundResources.close();
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to close resource", e);
+ }
+ }
+
+ @Override
+ public void shutdown() {
+ backgroundResources.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return backgroundResources.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return backgroundResources.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ backgroundResources.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return backgroundResources.awaitTermination(duration, unit);
+ }
+}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonReportErrorsServiceCallableFactory.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonReportErrorsServiceCallableFactory.java
new file mode 100644
index 00000000..106703c1
--- /dev/null
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonReportErrorsServiceCallableFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2022 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.devtools.clouderrorreporting.v1beta1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the ReportErrorsService service API.
+ *
+ * This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonReportErrorsServiceCallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonReportErrorsServiceStub.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonReportErrorsServiceStub.java
new file mode 100644
index 00000000..09394ae3
--- /dev/null
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/HttpJsonReportErrorsServiceStub.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2022 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.devtools.clouderrorreporting.v1beta1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.core.InternalApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.httpjson.ApiMethodDescriptor;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
+import com.google.api.gax.httpjson.ProtoMessageResponseParser;
+import com.google.api.gax.httpjson.ProtoRestSerializer;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest;
+import com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse;
+import com.google.protobuf.TypeRegistry;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the ReportErrorsService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonReportErrorsServiceStub extends ReportErrorsServiceStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor
+ reportErrorEventMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.devtools.clouderrorreporting.v1beta1.ReportErrorsService/ReportErrorEvent")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta1/{projectName=projects/*}/events:report",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields, "projectName", request.getProjectName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create().toBody("event", request.getEvent()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ReportErrorEventResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable
+ reportErrorEventCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonReportErrorsServiceStub create(
+ ReportErrorsServiceStubSettings settings) throws IOException {
+ return new HttpJsonReportErrorsServiceStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonReportErrorsServiceStub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonReportErrorsServiceStub(
+ ReportErrorsServiceStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonReportErrorsServiceStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonReportErrorsServiceStub(
+ ReportErrorsServiceStubSettings.newHttpJsonBuilder().build(),
+ clientContext,
+ callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonReportErrorsServiceStub, using the given settings. This is
+ * protected so that it is easy to make a subclass, but otherwise, the static factory methods
+ * should be preferred.
+ */
+ protected HttpJsonReportErrorsServiceStub(
+ ReportErrorsServiceStubSettings settings, ClientContext clientContext) throws IOException {
+ this(settings, clientContext, new HttpJsonReportErrorsServiceCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonReportErrorsServiceStub, using the given settings. This is
+ * protected so that it is easy to make a subclass, but otherwise, the static factory methods
+ * should be preferred.
+ */
+ protected HttpJsonReportErrorsServiceStub(
+ ReportErrorsServiceStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+
+ HttpJsonCallSettings
+ reportErrorEventTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(reportErrorEventMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+
+ this.reportErrorEventCallable =
+ callableFactory.createUnaryCallable(
+ reportErrorEventTransportSettings, settings.reportErrorEventSettings(), clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(reportErrorEventMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ @Override
+ public UnaryCallable
+ reportErrorEventCallable() {
+ return reportErrorEventCallable;
+ }
+
+ @Override
+ public final void close() {
+ try {
+ backgroundResources.close();
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to close resource", e);
+ }
+ }
+
+ @Override
+ public void shutdown() {
+ backgroundResources.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return backgroundResources.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return backgroundResources.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ backgroundResources.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return backgroundResources.awaitTermination(duration, unit);
+ }
+}
diff --git a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/ReportErrorsServiceStubSettings.java b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/ReportErrorsServiceStubSettings.java
index 54da7777..cd781b04 100644
--- a/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/ReportErrorsServiceStubSettings.java
+++ b/google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/stub/ReportErrorsServiceStubSettings.java
@@ -24,6 +24,9 @@
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
@@ -100,6 +103,11 @@ public ReportErrorsServiceStub createStub() throws IOException {
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcReportErrorsServiceStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonReportErrorsServiceStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -132,18 +140,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
.setUseJwtAccessWithScope(true);
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
- public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(ReportErrorsServiceStubSettings.class))
@@ -151,11 +166,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
- /** Returns a new builder for this class. */
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(ReportErrorsServiceStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return ReportErrorsServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -241,6 +275,19 @@ private static Builder createDefault() {
return initDefaults(builder);
}
+ private static Builder createHttpJsonDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
private static Builder initDefaults(Builder builder) {
builder
.reportErrorEventSettings()
diff --git a/google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorGroupServiceClientHttpJsonTest.java b/google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorGroupServiceClientHttpJsonTest.java
new file mode 100644
index 00000000..30cd8a61
--- /dev/null
+++ b/google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorGroupServiceClientHttpJsonTest.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2022 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.devtools.clouderrorreporting.v1beta1;
+
+import com.google.api.gax.core.NoCredentialsProvider;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.testing.MockHttpService;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ApiException;
+import com.google.api.gax.rpc.ApiExceptionFactory;
+import com.google.api.gax.rpc.InvalidArgumentException;
+import com.google.api.gax.rpc.StatusCode;
+import com.google.api.gax.rpc.testing.FakeStatusCode;
+import com.google.devtools.clouderrorreporting.v1beta1.stub.HttpJsonErrorGroupServiceStub;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Generated;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@Generated("by gapic-generator-java")
+public class ErrorGroupServiceClientHttpJsonTest {
+ private static MockHttpService mockService;
+ private static ErrorGroupServiceClient client;
+
+ @BeforeClass
+ public static void startStaticServer() throws IOException {
+ mockService =
+ new MockHttpService(
+ HttpJsonErrorGroupServiceStub.getMethodDescriptors(),
+ ErrorGroupServiceSettings.getDefaultEndpoint());
+ ErrorGroupServiceSettings settings =
+ ErrorGroupServiceSettings.newHttpJsonBuilder()
+ .setTransportChannelProvider(
+ ErrorGroupServiceSettings.defaultHttpJsonTransportProviderBuilder()
+ .setHttpTransport(mockService)
+ .build())
+ .setCredentialsProvider(NoCredentialsProvider.create())
+ .build();
+ client = ErrorGroupServiceClient.create(settings);
+ }
+
+ @AfterClass
+ public static void stopServer() {
+ client.close();
+ }
+
+ @Before
+ public void setUp() {}
+
+ @After
+ public void tearDown() throws Exception {
+ mockService.reset();
+ }
+
+ @Test
+ public void getGroupTest() throws Exception {
+ ErrorGroup expectedResponse =
+ ErrorGroup.newBuilder()
+ .setName(ErrorGroupName.of("[PROJECT]", "[GROUP]").toString())
+ .setGroupId("groupId293428218")
+ .addAllTrackingIssues(new ArrayList())
+ .setResolutionStatus(ResolutionStatus.forNumber(0))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ ErrorGroupName groupName = ErrorGroupName.of("[PROJECT]", "[GROUP]");
+
+ ErrorGroup actualResponse = client.getGroup(groupName);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void getGroupExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ErrorGroupName groupName = ErrorGroupName.of("[PROJECT]", "[GROUP]");
+ client.getGroup(groupName);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getGroupTest2() throws Exception {
+ ErrorGroup expectedResponse =
+ ErrorGroup.newBuilder()
+ .setName(ErrorGroupName.of("[PROJECT]", "[GROUP]").toString())
+ .setGroupId("groupId293428218")
+ .addAllTrackingIssues(new ArrayList())
+ .setResolutionStatus(ResolutionStatus.forNumber(0))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String groupName = "projects/project-3535/groups/group-3535";
+
+ ErrorGroup actualResponse = client.getGroup(groupName);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void getGroupExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String groupName = "projects/project-3535/groups/group-3535";
+ client.getGroup(groupName);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void updateGroupTest() throws Exception {
+ ErrorGroup expectedResponse =
+ ErrorGroup.newBuilder()
+ .setName(ErrorGroupName.of("[PROJECT]", "[GROUP]").toString())
+ .setGroupId("groupId293428218")
+ .addAllTrackingIssues(new ArrayList())
+ .setResolutionStatus(ResolutionStatus.forNumber(0))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ ErrorGroup group =
+ ErrorGroup.newBuilder()
+ .setName(ErrorGroupName.of("[PROJECT]", "[GROUP]").toString())
+ .setGroupId("groupId293428218")
+ .addAllTrackingIssues(new ArrayList())
+ .setResolutionStatus(ResolutionStatus.forNumber(0))
+ .build();
+
+ ErrorGroup actualResponse = client.updateGroup(group);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void updateGroupExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ErrorGroup group =
+ ErrorGroup.newBuilder()
+ .setName(ErrorGroupName.of("[PROJECT]", "[GROUP]").toString())
+ .setGroupId("groupId293428218")
+ .addAllTrackingIssues(new ArrayList())
+ .setResolutionStatus(ResolutionStatus.forNumber(0))
+ .build();
+ client.updateGroup(group);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+}
diff --git a/google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClientHttpJsonTest.java b/google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClientHttpJsonTest.java
new file mode 100644
index 00000000..899ac8b8
--- /dev/null
+++ b/google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClientHttpJsonTest.java
@@ -0,0 +1,368 @@
+/*
+ * Copyright 2022 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.devtools.clouderrorreporting.v1beta1;
+
+import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListEventsPagedResponse;
+import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListGroupStatsPagedResponse;
+
+import com.google.api.gax.core.NoCredentialsProvider;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.testing.MockHttpService;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ApiException;
+import com.google.api.gax.rpc.ApiExceptionFactory;
+import com.google.api.gax.rpc.InvalidArgumentException;
+import com.google.api.gax.rpc.StatusCode;
+import com.google.api.gax.rpc.testing.FakeStatusCode;
+import com.google.common.collect.Lists;
+import com.google.devtools.clouderrorreporting.v1beta1.stub.HttpJsonErrorStatsServiceStub;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import javax.annotation.Generated;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@Generated("by gapic-generator-java")
+public class ErrorStatsServiceClientHttpJsonTest {
+ private static MockHttpService mockService;
+ private static ErrorStatsServiceClient client;
+
+ @BeforeClass
+ public static void startStaticServer() throws IOException {
+ mockService =
+ new MockHttpService(
+ HttpJsonErrorStatsServiceStub.getMethodDescriptors(),
+ ErrorStatsServiceSettings.getDefaultEndpoint());
+ ErrorStatsServiceSettings settings =
+ ErrorStatsServiceSettings.newHttpJsonBuilder()
+ .setTransportChannelProvider(
+ ErrorStatsServiceSettings.defaultHttpJsonTransportProviderBuilder()
+ .setHttpTransport(mockService)
+ .build())
+ .setCredentialsProvider(NoCredentialsProvider.create())
+ .build();
+ client = ErrorStatsServiceClient.create(settings);
+ }
+
+ @AfterClass
+ public static void stopServer() {
+ client.close();
+ }
+
+ @Before
+ public void setUp() {}
+
+ @After
+ public void tearDown() throws Exception {
+ mockService.reset();
+ }
+
+ @Test
+ public void listGroupStatsTest() throws Exception {
+ ErrorGroupStats responsesElement = ErrorGroupStats.newBuilder().build();
+ ListGroupStatsResponse expectedResponse =
+ ListGroupStatsResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllErrorGroupStats(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ ProjectName projectName = ProjectName.of("[PROJECT]");
+ QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
+
+ ListGroupStatsPagedResponse pagedListResponse = client.listGroupStats(projectName, timeRange);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getErrorGroupStatsList().get(0), resources.get(0));
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void listGroupStatsExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ProjectName projectName = ProjectName.of("[PROJECT]");
+ QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
+ client.listGroupStats(projectName, timeRange);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listGroupStatsTest2() throws Exception {
+ ErrorGroupStats responsesElement = ErrorGroupStats.newBuilder().build();
+ ListGroupStatsResponse expectedResponse =
+ ListGroupStatsResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllErrorGroupStats(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String projectName = "projects/project-3287";
+ QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
+
+ ListGroupStatsPagedResponse pagedListResponse = client.listGroupStats(projectName, timeRange);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getErrorGroupStatsList().get(0), resources.get(0));
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void listGroupStatsExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String projectName = "projects/project-3287";
+ QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
+ client.listGroupStats(projectName, timeRange);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listEventsTest() throws Exception {
+ ErrorEvent responsesElement = ErrorEvent.newBuilder().build();
+ ListEventsResponse expectedResponse =
+ ListEventsResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllErrorEvents(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ ProjectName projectName = ProjectName.of("[PROJECT]");
+ String groupId = "groupId293428218";
+
+ ListEventsPagedResponse pagedListResponse = client.listEvents(projectName, groupId);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getErrorEventsList().get(0), resources.get(0));
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void listEventsExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ProjectName projectName = ProjectName.of("[PROJECT]");
+ String groupId = "groupId293428218";
+ client.listEvents(projectName, groupId);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listEventsTest2() throws Exception {
+ ErrorEvent responsesElement = ErrorEvent.newBuilder().build();
+ ListEventsResponse expectedResponse =
+ ListEventsResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllErrorEvents(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String projectName = "projects/project-3287";
+ String groupId = "groupId293428218";
+
+ ListEventsPagedResponse pagedListResponse = client.listEvents(projectName, groupId);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getErrorEventsList().get(0), resources.get(0));
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void listEventsExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String projectName = "projects/project-3287";
+ String groupId = "groupId293428218";
+ client.listEvents(projectName, groupId);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void deleteEventsTest() throws Exception {
+ DeleteEventsResponse expectedResponse = DeleteEventsResponse.newBuilder().build();
+ mockService.addResponse(expectedResponse);
+
+ ProjectName projectName = ProjectName.of("[PROJECT]");
+
+ DeleteEventsResponse actualResponse = client.deleteEvents(projectName);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void deleteEventsExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ProjectName projectName = ProjectName.of("[PROJECT]");
+ client.deleteEvents(projectName);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void deleteEventsTest2() throws Exception {
+ DeleteEventsResponse expectedResponse = DeleteEventsResponse.newBuilder().build();
+ mockService.addResponse(expectedResponse);
+
+ String projectName = "projects/project-3287";
+
+ DeleteEventsResponse actualResponse = client.deleteEvents(projectName);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void deleteEventsExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String projectName = "projects/project-3287";
+ client.deleteEvents(projectName);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+}
diff --git a/google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ReportErrorsServiceClientHttpJsonTest.java b/google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ReportErrorsServiceClientHttpJsonTest.java
new file mode 100644
index 00000000..84b50596
--- /dev/null
+++ b/google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ReportErrorsServiceClientHttpJsonTest.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2022 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.devtools.clouderrorreporting.v1beta1;
+
+import com.google.api.gax.core.NoCredentialsProvider;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.testing.MockHttpService;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ApiException;
+import com.google.api.gax.rpc.ApiExceptionFactory;
+import com.google.api.gax.rpc.InvalidArgumentException;
+import com.google.api.gax.rpc.StatusCode;
+import com.google.api.gax.rpc.testing.FakeStatusCode;
+import com.google.devtools.clouderrorreporting.v1beta1.stub.HttpJsonReportErrorsServiceStub;
+import java.io.IOException;
+import java.util.List;
+import javax.annotation.Generated;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@Generated("by gapic-generator-java")
+public class ReportErrorsServiceClientHttpJsonTest {
+ private static MockHttpService mockService;
+ private static ReportErrorsServiceClient client;
+
+ @BeforeClass
+ public static void startStaticServer() throws IOException {
+ mockService =
+ new MockHttpService(
+ HttpJsonReportErrorsServiceStub.getMethodDescriptors(),
+ ReportErrorsServiceSettings.getDefaultEndpoint());
+ ReportErrorsServiceSettings settings =
+ ReportErrorsServiceSettings.newHttpJsonBuilder()
+ .setTransportChannelProvider(
+ ReportErrorsServiceSettings.defaultHttpJsonTransportProviderBuilder()
+ .setHttpTransport(mockService)
+ .build())
+ .setCredentialsProvider(NoCredentialsProvider.create())
+ .build();
+ client = ReportErrorsServiceClient.create(settings);
+ }
+
+ @AfterClass
+ public static void stopServer() {
+ client.close();
+ }
+
+ @Before
+ public void setUp() {}
+
+ @After
+ public void tearDown() throws Exception {
+ mockService.reset();
+ }
+
+ @Test
+ public void reportErrorEventTest() throws Exception {
+ ReportErrorEventResponse expectedResponse = ReportErrorEventResponse.newBuilder().build();
+ mockService.addResponse(expectedResponse);
+
+ ProjectName projectName = ProjectName.of("[PROJECT]");
+ ReportedErrorEvent event = ReportedErrorEvent.newBuilder().build();
+
+ ReportErrorEventResponse actualResponse = client.reportErrorEvent(projectName, event);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void reportErrorEventExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ProjectName projectName = ProjectName.of("[PROJECT]");
+ ReportedErrorEvent event = ReportedErrorEvent.newBuilder().build();
+ client.reportErrorEvent(projectName, event);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void reportErrorEventTest2() throws Exception {
+ ReportErrorEventResponse expectedResponse = ReportErrorEventResponse.newBuilder().build();
+ mockService.addResponse(expectedResponse);
+
+ String projectName = "projects/project-3287";
+ ReportedErrorEvent event = ReportedErrorEvent.newBuilder().build();
+
+ ReportErrorEventResponse actualResponse = client.reportErrorEvent(projectName, event);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void reportErrorEventExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String projectName = "projects/project-3287";
+ ReportedErrorEvent event = ReportedErrorEvent.newBuilder().build();
+ client.reportErrorEvent(projectName, event);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+}