diff --git a/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/ConnectionServiceClient.java b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/ConnectionServiceClient.java
index 82b08b1d4888..9c9e02d2291f 100644
--- a/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/ConnectionServiceClient.java
+++ b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/ConnectionServiceClient.java
@@ -101,6 +101,21 @@
* ConnectionServiceClient.create(connectionServiceSettings);
* }
*
+ * 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.
+ * ConnectionServiceSettings connectionServiceSettings =
+ * ConnectionServiceSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * ConnectionServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * ConnectionServiceClient connectionServiceClient =
+ * ConnectionServiceClient.create(connectionServiceSettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
diff --git a/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/ConnectionServiceSettings.java b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/ConnectionServiceSettings.java
index 60acbe9bfdfc..4028ffa3b32c 100644
--- a/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/ConnectionServiceSettings.java
+++ b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/ConnectionServiceSettings.java
@@ -23,6 +23,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;
@@ -103,11 +104,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return ConnectionServiceStubSettings.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 ConnectionServiceStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return ConnectionServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return ConnectionServiceStubSettings.defaultTransportChannelProvider();
}
@@ -117,11 +125,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return ConnectionServiceStubSettings.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);
@@ -159,6 +173,11 @@ private static Builder createDefault() {
return new Builder(ConnectionServiceStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(ConnectionServiceStubSettings.newHttpJsonBuilder());
+ }
+
public ConnectionServiceStubSettings.Builder getStubSettingsBuilder() {
return ((ConnectionServiceStubSettings.Builder) getStubSettings());
}
diff --git a/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/TetherClient.java b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/TetherClient.java
index 2d94ce8c0864..b68bb24569ac 100644
--- a/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/TetherClient.java
+++ b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/TetherClient.java
@@ -102,6 +102,20 @@
* TetherClient tetherClient = TetherClient.create(tetherSettings);
* }
*
+ *
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.
+ * TetherSettings tetherSettings =
+ * TetherSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * TetherSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * TetherClient tetherClient = TetherClient.create(tetherSettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
diff --git a/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/TetherSettings.java b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/TetherSettings.java
index 4f7c624098dd..0a674697e5ff 100644
--- a/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/TetherSettings.java
+++ b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/TetherSettings.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;
@@ -97,11 +98,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return TetherStubSettings.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 TetherStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return TetherStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return TetherStubSettings.defaultTransportChannelProvider();
}
@@ -111,11 +119,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return TetherStubSettings.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);
@@ -153,6 +167,11 @@ private static Builder createDefault() {
return new Builder(TetherStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(TetherStubSettings.newHttpJsonBuilder());
+ }
+
public TetherStubSettings.Builder getStubSettingsBuilder() {
return ((TetherStubSettings.Builder) getStubSettings());
}
diff --git a/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/ConnectionServiceStubSettings.java b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/ConnectionServiceStubSettings.java
index bf6a2ce983de..60cb25f6f7dd 100644
--- a/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/ConnectionServiceStubSettings.java
+++ b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/ConnectionServiceStubSettings.java
@@ -27,6 +27,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;
@@ -166,6 +169,11 @@ public ConnectionServiceStub createStub() throws IOException {
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcConnectionServiceStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonConnectionServiceStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -198,18 +206,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(ConnectionServiceStubSettings.class))
@@ -217,11 +232,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(ConnectionServiceStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return ConnectionServiceStubSettings.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);
@@ -313,6 +347,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
.listConnectionsSettings()
diff --git a/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/HttpJsonConnectionServiceCallableFactory.java b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/HttpJsonConnectionServiceCallableFactory.java
new file mode 100644
index 000000000000..6aa75e620675
--- /dev/null
+++ b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/HttpJsonConnectionServiceCallableFactory.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.cloud.apigeeconnect.v1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+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 ConnectionService service API.
+ *
+ *
This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonConnectionServiceCallableFactory
+ 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/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/HttpJsonConnectionServiceStub.java b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/HttpJsonConnectionServiceStub.java
new file mode 100644
index 000000000000..dfba9a84ad8f
--- /dev/null
+++ b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/HttpJsonConnectionServiceStub.java
@@ -0,0 +1,208 @@
+/*
+ * 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.cloud.apigeeconnect.v1.stub;
+
+import static com.google.cloud.apigeeconnect.v1.ConnectionServiceClient.ListConnectionsPagedResponse;
+
+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.cloud.apigeeconnect.v1.ListConnectionsRequest;
+import com.google.cloud.apigeeconnect.v1.ListConnectionsResponse;
+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 ConnectionService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonConnectionServiceStub extends ConnectionServiceStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor
+ listConnectionsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.apigeeconnect.v1.ConnectionService/ListConnections")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/endpoints/*}/connections",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListConnectionsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable
+ listConnectionsCallable;
+ private final UnaryCallable
+ listConnectionsPagedCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonConnectionServiceStub create(ConnectionServiceStubSettings settings)
+ throws IOException {
+ return new HttpJsonConnectionServiceStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonConnectionServiceStub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonConnectionServiceStub(
+ ConnectionServiceStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonConnectionServiceStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonConnectionServiceStub(
+ ConnectionServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonConnectionServiceStub, 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 HttpJsonConnectionServiceStub(
+ ConnectionServiceStubSettings settings, ClientContext clientContext) throws IOException {
+ this(settings, clientContext, new HttpJsonConnectionServiceCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonConnectionServiceStub, 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 HttpJsonConnectionServiceStub(
+ ConnectionServiceStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+
+ HttpJsonCallSettings
+ listConnectionsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listConnectionsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+
+ this.listConnectionsCallable =
+ callableFactory.createUnaryCallable(
+ listConnectionsTransportSettings, settings.listConnectionsSettings(), clientContext);
+ this.listConnectionsPagedCallable =
+ callableFactory.createPagedCallable(
+ listConnectionsTransportSettings, settings.listConnectionsSettings(), clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(listConnectionsMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ @Override
+ public UnaryCallable listConnectionsCallable() {
+ return listConnectionsCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listConnectionsPagedCallable() {
+ return listConnectionsPagedCallable;
+ }
+
+ @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/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/HttpJsonTetherCallableFactory.java b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/HttpJsonTetherCallableFactory.java
new file mode 100644
index 000000000000..915ddf53a75e
--- /dev/null
+++ b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/HttpJsonTetherCallableFactory.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.cloud.apigeeconnect.v1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+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 Tether service API.
+ *
+ * This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonTetherCallableFactory
+ 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/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/HttpJsonTetherStub.java b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/HttpJsonTetherStub.java
new file mode 100644
index 000000000000..24aadd00ae80
--- /dev/null
+++ b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/HttpJsonTetherStub.java
@@ -0,0 +1,128 @@
+/*
+ * 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.cloud.apigeeconnect.v1.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.HttpJsonStubCallableFactory;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.protobuf.TypeRegistry;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the Tether service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonTetherStub extends TetherStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonTetherStub create(TetherStubSettings settings) throws IOException {
+ return new HttpJsonTetherStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonTetherStub create(ClientContext clientContext) throws IOException {
+ return new HttpJsonTetherStub(TetherStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonTetherStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonTetherStub(
+ TetherStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonTetherStub, 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 HttpJsonTetherStub(TetherStubSettings settings, ClientContext clientContext)
+ throws IOException {
+ this(settings, clientContext, new HttpJsonTetherCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonTetherStub, 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 HttpJsonTetherStub(
+ TetherStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ return methodDescriptors;
+ }
+
+ @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/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/TetherStubSettings.java b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/TetherStubSettings.java
index f96bc169a36d..803d5b9b3f1e 100644
--- a/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/TetherStubSettings.java
+++ b/java-apigee-connect/google-cloud-apigee-connect/src/main/java/com/google/cloud/apigeeconnect/v1/stub/TetherStubSettings.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;
@@ -94,6 +97,11 @@ public TetherStub createStub() throws IOException {
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcTetherStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonTetherStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -126,29 +134,54 @@ 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(TetherStubSettings.class))
.setTransportToken(
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(TetherStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return TetherStubSettings.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);
@@ -223,6 +256,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) {
return builder;
}
diff --git a/java-apigee-connect/google-cloud-apigee-connect/src/test/java/com/google/cloud/apigeeconnect/v1/ConnectionServiceClientHttpJsonTest.java b/java-apigee-connect/google-cloud-apigee-connect/src/test/java/com/google/cloud/apigeeconnect/v1/ConnectionServiceClientHttpJsonTest.java
new file mode 100644
index 000000000000..3f8d216e7bd1
--- /dev/null
+++ b/java-apigee-connect/google-cloud-apigee-connect/src/test/java/com/google/cloud/apigeeconnect/v1/ConnectionServiceClientHttpJsonTest.java
@@ -0,0 +1,177 @@
+/*
+ * 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.cloud.apigeeconnect.v1;
+
+import static com.google.cloud.apigeeconnect.v1.ConnectionServiceClient.ListConnectionsPagedResponse;
+
+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.cloud.apigeeconnect.v1.stub.HttpJsonConnectionServiceStub;
+import com.google.common.collect.Lists;
+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 ConnectionServiceClientHttpJsonTest {
+ private static MockHttpService mockService;
+ private static ConnectionServiceClient client;
+
+ @BeforeClass
+ public static void startStaticServer() throws IOException {
+ mockService =
+ new MockHttpService(
+ HttpJsonConnectionServiceStub.getMethodDescriptors(),
+ ConnectionServiceSettings.getDefaultEndpoint());
+ ConnectionServiceSettings settings =
+ ConnectionServiceSettings.newHttpJsonBuilder()
+ .setTransportChannelProvider(
+ ConnectionServiceSettings.defaultHttpJsonTransportProviderBuilder()
+ .setHttpTransport(mockService)
+ .build())
+ .setCredentialsProvider(NoCredentialsProvider.create())
+ .build();
+ client = ConnectionServiceClient.create(settings);
+ }
+
+ @AfterClass
+ public static void stopServer() {
+ client.close();
+ }
+
+ @Before
+ public void setUp() {}
+
+ @After
+ public void tearDown() throws Exception {
+ mockService.reset();
+ }
+
+ @Test
+ public void listConnectionsTest() throws Exception {
+ Connection responsesElement = Connection.newBuilder().build();
+ ListConnectionsResponse expectedResponse =
+ ListConnectionsResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllConnections(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ EndpointName parent = EndpointName.of("[PROJECT]", "[ENDPOINT]");
+
+ ListConnectionsPagedResponse pagedListResponse = client.listConnections(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getConnectionsList().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 listConnectionsExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ EndpointName parent = EndpointName.of("[PROJECT]", "[ENDPOINT]");
+ client.listConnections(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listConnectionsTest2() throws Exception {
+ Connection responsesElement = Connection.newBuilder().build();
+ ListConnectionsResponse expectedResponse =
+ ListConnectionsResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllConnections(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String parent = "projects/project-7865/endpoints/endpoint-7865";
+
+ ListConnectionsPagedResponse pagedListResponse = client.listConnections(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getConnectionsList().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 listConnectionsExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String parent = "projects/project-7865/endpoints/endpoint-7865";
+ client.listConnections(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+}
diff --git a/java-apigee-connect/google-cloud-apigee-connect/src/test/java/com/google/cloud/apigeeconnect/v1/TetherClientHttpJsonTest.java b/java-apigee-connect/google-cloud-apigee-connect/src/test/java/com/google/cloud/apigeeconnect/v1/TetherClientHttpJsonTest.java
new file mode 100644
index 000000000000..eff7640e24bb
--- /dev/null
+++ b/java-apigee-connect/google-cloud-apigee-connect/src/test/java/com/google/cloud/apigeeconnect/v1/TetherClientHttpJsonTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.cloud.apigeeconnect.v1;
+
+import com.google.api.gax.core.NoCredentialsProvider;
+import com.google.api.gax.httpjson.testing.MockHttpService;
+import com.google.cloud.apigeeconnect.v1.stub.HttpJsonTetherStub;
+import java.io.IOException;
+import javax.annotation.Generated;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@Generated("by gapic-generator-java")
+public class TetherClientHttpJsonTest {
+ private static MockHttpService mockService;
+ private static TetherClient client;
+
+ @BeforeClass
+ public static void startStaticServer() throws IOException {
+ mockService =
+ new MockHttpService(
+ HttpJsonTetherStub.getMethodDescriptors(), TetherSettings.getDefaultEndpoint());
+ TetherSettings settings =
+ TetherSettings.newHttpJsonBuilder()
+ .setTransportChannelProvider(
+ TetherSettings.defaultHttpJsonTransportProviderBuilder()
+ .setHttpTransport(mockService)
+ .build())
+ .setCredentialsProvider(NoCredentialsProvider.create())
+ .build();
+ client = TetherClient.create(settings);
+ }
+
+ @AfterClass
+ public static void stopServer() {
+ client.close();
+ }
+
+ @Before
+ public void setUp() {}
+
+ @After
+ public void tearDown() throws Exception {
+ mockService.reset();
+ }
+
+ @Test
+ public void egressUnsupportedMethodTest() throws Exception {
+ // The egress() method is not supported in REST transport.
+ // This empty test is generated for technical reasons.
+ }
+}
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/create/SyncCreateSetCredentialsProvider.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/create/SyncCreateSetCredentialsProvider.java
new file mode 100644
index 000000000000..b163415d8619
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/create/SyncCreateSetCredentialsProvider.java
@@ -0,0 +1,42 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_connectionserviceclient_create_setcredentialsprovider_sync]
+import com.google.api.gax.core.FixedCredentialsProvider;
+import com.google.cloud.apigeeconnect.v1.ConnectionServiceClient;
+import com.google.cloud.apigeeconnect.v1.ConnectionServiceSettings;
+import com.google.cloud.apigeeconnect.v1.myCredentials;
+
+public class SyncCreateSetCredentialsProvider {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetCredentialsProvider();
+ }
+
+ public static void syncCreateSetCredentialsProvider() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ ConnectionServiceSettings connectionServiceSettings =
+ ConnectionServiceSettings.newBuilder()
+ .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ .build();
+ ConnectionServiceClient connectionServiceClient =
+ ConnectionServiceClient.create(connectionServiceSettings);
+ }
+}
+// [END apigeeconnect_v1_generated_connectionserviceclient_create_setcredentialsprovider_sync]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/create/SyncCreateSetCredentialsProvider1.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/create/SyncCreateSetCredentialsProvider1.java
new file mode 100644
index 000000000000..9cf2fff7081a
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/create/SyncCreateSetCredentialsProvider1.java
@@ -0,0 +1,41 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_connectionserviceclient_create_setcredentialsprovider1_sync]
+import com.google.cloud.apigeeconnect.v1.ConnectionServiceClient;
+import com.google.cloud.apigeeconnect.v1.ConnectionServiceSettings;
+
+public class SyncCreateSetCredentialsProvider1 {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetCredentialsProvider1();
+ }
+
+ public static void syncCreateSetCredentialsProvider1() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ ConnectionServiceSettings connectionServiceSettings =
+ ConnectionServiceSettings.newBuilder()
+ .setTransportChannelProvider(
+ ConnectionServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ .build();
+ ConnectionServiceClient connectionServiceClient =
+ ConnectionServiceClient.create(connectionServiceSettings);
+ }
+}
+// [END apigeeconnect_v1_generated_connectionserviceclient_create_setcredentialsprovider1_sync]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/create/SyncCreateSetEndpoint.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/create/SyncCreateSetEndpoint.java
new file mode 100644
index 000000000000..6997871c10a6
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/create/SyncCreateSetEndpoint.java
@@ -0,0 +1,39 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_connectionserviceclient_create_setendpoint_sync]
+import com.google.cloud.apigeeconnect.v1.ConnectionServiceClient;
+import com.google.cloud.apigeeconnect.v1.ConnectionServiceSettings;
+import com.google.cloud.apigeeconnect.v1.myEndpoint;
+
+public class SyncCreateSetEndpoint {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetEndpoint();
+ }
+
+ public static void syncCreateSetEndpoint() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ ConnectionServiceSettings connectionServiceSettings =
+ ConnectionServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ ConnectionServiceClient connectionServiceClient =
+ ConnectionServiceClient.create(connectionServiceSettings);
+ }
+}
+// [END apigeeconnect_v1_generated_connectionserviceclient_create_setendpoint_sync]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/AsyncListConnections.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/AsyncListConnections.java
new file mode 100644
index 000000000000..90a4fe649c51
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/AsyncListConnections.java
@@ -0,0 +1,51 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_connectionserviceclient_listconnections_async]
+import com.google.api.core.ApiFuture;
+import com.google.cloud.apigeeconnect.v1.Connection;
+import com.google.cloud.apigeeconnect.v1.ConnectionServiceClient;
+import com.google.cloud.apigeeconnect.v1.EndpointName;
+import com.google.cloud.apigeeconnect.v1.ListConnectionsRequest;
+
+public class AsyncListConnections {
+
+ public static void main(String[] args) throws Exception {
+ asyncListConnections();
+ }
+
+ public static void asyncListConnections() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+ ListConnectionsRequest request =
+ ListConnectionsRequest.newBuilder()
+ .setParent(EndpointName.of("[PROJECT]", "[ENDPOINT]").toString())
+ .setPageSize(883849137)
+ .setPageToken("pageToken873572522")
+ .build();
+ ApiFuture future =
+ connectionServiceClient.listConnectionsPagedCallable().futureCall(request);
+ // Do something.
+ for (Connection element : future.get().iterateAll()) {
+ // doThingsWith(element);
+ }
+ }
+ }
+}
+// [END apigeeconnect_v1_generated_connectionserviceclient_listconnections_async]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/AsyncListConnectionsPaged.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/AsyncListConnectionsPaged.java
new file mode 100644
index 000000000000..64b52769906c
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/AsyncListConnectionsPaged.java
@@ -0,0 +1,59 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_connectionserviceclient_listconnections_paged_async]
+import com.google.cloud.apigeeconnect.v1.Connection;
+import com.google.cloud.apigeeconnect.v1.ConnectionServiceClient;
+import com.google.cloud.apigeeconnect.v1.EndpointName;
+import com.google.cloud.apigeeconnect.v1.ListConnectionsRequest;
+import com.google.cloud.apigeeconnect.v1.ListConnectionsResponse;
+import com.google.common.base.Strings;
+
+public class AsyncListConnectionsPaged {
+
+ public static void main(String[] args) throws Exception {
+ asyncListConnectionsPaged();
+ }
+
+ public static void asyncListConnectionsPaged() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+ ListConnectionsRequest request =
+ ListConnectionsRequest.newBuilder()
+ .setParent(EndpointName.of("[PROJECT]", "[ENDPOINT]").toString())
+ .setPageSize(883849137)
+ .setPageToken("pageToken873572522")
+ .build();
+ while (true) {
+ ListConnectionsResponse response =
+ connectionServiceClient.listConnectionsCallable().call(request);
+ for (Connection element : response.getConnectionsList()) {
+ // doThingsWith(element);
+ }
+ String nextPageToken = response.getNextPageToken();
+ if (!Strings.isNullOrEmpty(nextPageToken)) {
+ request = request.toBuilder().setPageToken(nextPageToken).build();
+ } else {
+ break;
+ }
+ }
+ }
+ }
+}
+// [END apigeeconnect_v1_generated_connectionserviceclient_listconnections_paged_async]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/SyncListConnections.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/SyncListConnections.java
new file mode 100644
index 000000000000..50ce913809ae
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/SyncListConnections.java
@@ -0,0 +1,47 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_connectionserviceclient_listconnections_sync]
+import com.google.cloud.apigeeconnect.v1.Connection;
+import com.google.cloud.apigeeconnect.v1.ConnectionServiceClient;
+import com.google.cloud.apigeeconnect.v1.EndpointName;
+import com.google.cloud.apigeeconnect.v1.ListConnectionsRequest;
+
+public class SyncListConnections {
+
+ public static void main(String[] args) throws Exception {
+ syncListConnections();
+ }
+
+ public static void syncListConnections() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+ ListConnectionsRequest request =
+ ListConnectionsRequest.newBuilder()
+ .setParent(EndpointName.of("[PROJECT]", "[ENDPOINT]").toString())
+ .setPageSize(883849137)
+ .setPageToken("pageToken873572522")
+ .build();
+ for (Connection element : connectionServiceClient.listConnections(request).iterateAll()) {
+ // doThingsWith(element);
+ }
+ }
+ }
+}
+// [END apigeeconnect_v1_generated_connectionserviceclient_listconnections_sync]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/SyncListConnectionsEndpointname.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/SyncListConnectionsEndpointname.java
new file mode 100644
index 000000000000..bd5f57919505
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/SyncListConnectionsEndpointname.java
@@ -0,0 +1,41 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_connectionserviceclient_listconnections_endpointname_sync]
+import com.google.cloud.apigeeconnect.v1.Connection;
+import com.google.cloud.apigeeconnect.v1.ConnectionServiceClient;
+import com.google.cloud.apigeeconnect.v1.EndpointName;
+
+public class SyncListConnectionsEndpointname {
+
+ public static void main(String[] args) throws Exception {
+ syncListConnectionsEndpointname();
+ }
+
+ public static void syncListConnectionsEndpointname() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+ EndpointName parent = EndpointName.of("[PROJECT]", "[ENDPOINT]");
+ for (Connection element : connectionServiceClient.listConnections(parent).iterateAll()) {
+ // doThingsWith(element);
+ }
+ }
+ }
+}
+// [END apigeeconnect_v1_generated_connectionserviceclient_listconnections_endpointname_sync]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/SyncListConnectionsString.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/SyncListConnectionsString.java
new file mode 100644
index 000000000000..2f0f455c4e48
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionserviceclient/listconnections/SyncListConnectionsString.java
@@ -0,0 +1,41 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_connectionserviceclient_listconnections_string_sync]
+import com.google.cloud.apigeeconnect.v1.Connection;
+import com.google.cloud.apigeeconnect.v1.ConnectionServiceClient;
+import com.google.cloud.apigeeconnect.v1.EndpointName;
+
+public class SyncListConnectionsString {
+
+ public static void main(String[] args) throws Exception {
+ syncListConnectionsString();
+ }
+
+ public static void syncListConnectionsString() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.create()) {
+ String parent = EndpointName.of("[PROJECT]", "[ENDPOINT]").toString();
+ for (Connection element : connectionServiceClient.listConnections(parent).iterateAll()) {
+ // doThingsWith(element);
+ }
+ }
+ }
+}
+// [END apigeeconnect_v1_generated_connectionserviceclient_listconnections_string_sync]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionservicesettings/listconnections/SyncListConnections.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionservicesettings/listconnections/SyncListConnections.java
new file mode 100644
index 000000000000..49818859cd77
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/connectionservicesettings/listconnections/SyncListConnections.java
@@ -0,0 +1,46 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_connectionservicesettings_listconnections_sync]
+import com.google.cloud.apigeeconnect.v1.ConnectionServiceSettings;
+import java.time.Duration;
+
+public class SyncListConnections {
+
+ public static void main(String[] args) throws Exception {
+ syncListConnections();
+ }
+
+ public static void syncListConnections() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ ConnectionServiceSettings.Builder connectionServiceSettingsBuilder =
+ ConnectionServiceSettings.newBuilder();
+ connectionServiceSettingsBuilder
+ .listConnectionsSettings()
+ .setRetrySettings(
+ connectionServiceSettingsBuilder
+ .listConnectionsSettings()
+ .getRetrySettings()
+ .toBuilder()
+ .setTotalTimeout(Duration.ofSeconds(30))
+ .build());
+ ConnectionServiceSettings connectionServiceSettings = connectionServiceSettingsBuilder.build();
+ }
+}
+// [END apigeeconnect_v1_generated_connectionservicesettings_listconnections_sync]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/stub/connectionservicestubsettings/listconnections/SyncListConnections.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/stub/connectionservicestubsettings/listconnections/SyncListConnections.java
new file mode 100644
index 000000000000..1f3b9f7502ab
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/stub/connectionservicestubsettings/listconnections/SyncListConnections.java
@@ -0,0 +1,47 @@
+/*
+ * 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.cloud.apigeeconnect.v1.stub.samples;
+
+// [START apigeeconnect_v1_generated_connectionservicestubsettings_listconnections_sync]
+import com.google.cloud.apigeeconnect.v1.stub.ConnectionServiceStubSettings;
+import java.time.Duration;
+
+public class SyncListConnections {
+
+ public static void main(String[] args) throws Exception {
+ syncListConnections();
+ }
+
+ public static void syncListConnections() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ ConnectionServiceStubSettings.Builder connectionServiceSettingsBuilder =
+ ConnectionServiceStubSettings.newBuilder();
+ connectionServiceSettingsBuilder
+ .listConnectionsSettings()
+ .setRetrySettings(
+ connectionServiceSettingsBuilder
+ .listConnectionsSettings()
+ .getRetrySettings()
+ .toBuilder()
+ .setTotalTimeout(Duration.ofSeconds(30))
+ .build());
+ ConnectionServiceStubSettings connectionServiceSettings =
+ connectionServiceSettingsBuilder.build();
+ }
+}
+// [END apigeeconnect_v1_generated_connectionservicestubsettings_listconnections_sync]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/stub/tetherstubsettings/egress/SyncEgress.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/stub/tetherstubsettings/egress/SyncEgress.java
new file mode 100644
index 000000000000..7db481ba1ec3
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/stub/tetherstubsettings/egress/SyncEgress.java
@@ -0,0 +1,45 @@
+/*
+ * 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.cloud.apigeeconnect.v1.stub.samples;
+
+// [START apigeeconnect_v1_generated_tetherstubsettings_egress_sync]
+import com.google.cloud.apigeeconnect.v1.stub.TetherStubSettings;
+import java.time.Duration;
+
+public class SyncEgress {
+
+ public static void main(String[] args) throws Exception {
+ syncEgress();
+ }
+
+ public static void syncEgress() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ TetherStubSettings.Builder tetherSettingsBuilder = TetherStubSettings.newBuilder();
+ tetherSettingsBuilder
+ .egressSettings()
+ .setRetrySettings(
+ tetherSettingsBuilder
+ .egressSettings()
+ .getRetrySettings()
+ .toBuilder()
+ .setTotalTimeout(Duration.ofSeconds(30))
+ .build());
+ TetherStubSettings tetherSettings = tetherSettingsBuilder.build();
+ }
+}
+// [END apigeeconnect_v1_generated_tetherstubsettings_egress_sync]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tetherclient/create/SyncCreateSetCredentialsProvider.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tetherclient/create/SyncCreateSetCredentialsProvider.java
new file mode 100644
index 000000000000..b43cb84ab011
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tetherclient/create/SyncCreateSetCredentialsProvider.java
@@ -0,0 +1,41 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_tetherclient_create_setcredentialsprovider_sync]
+import com.google.api.gax.core.FixedCredentialsProvider;
+import com.google.cloud.apigeeconnect.v1.TetherClient;
+import com.google.cloud.apigeeconnect.v1.TetherSettings;
+import com.google.cloud.apigeeconnect.v1.myCredentials;
+
+public class SyncCreateSetCredentialsProvider {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetCredentialsProvider();
+ }
+
+ public static void syncCreateSetCredentialsProvider() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ TetherSettings tetherSettings =
+ TetherSettings.newBuilder()
+ .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ .build();
+ TetherClient tetherClient = TetherClient.create(tetherSettings);
+ }
+}
+// [END apigeeconnect_v1_generated_tetherclient_create_setcredentialsprovider_sync]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tetherclient/create/SyncCreateSetCredentialsProvider1.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tetherclient/create/SyncCreateSetCredentialsProvider1.java
new file mode 100644
index 000000000000..1661a95af89e
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tetherclient/create/SyncCreateSetCredentialsProvider1.java
@@ -0,0 +1,40 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_tetherclient_create_setcredentialsprovider1_sync]
+import com.google.cloud.apigeeconnect.v1.TetherClient;
+import com.google.cloud.apigeeconnect.v1.TetherSettings;
+
+public class SyncCreateSetCredentialsProvider1 {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetCredentialsProvider1();
+ }
+
+ public static void syncCreateSetCredentialsProvider1() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ TetherSettings tetherSettings =
+ TetherSettings.newBuilder()
+ .setTransportChannelProvider(
+ TetherSettings.defaultHttpJsonTransportProviderBuilder().build())
+ .build();
+ TetherClient tetherClient = TetherClient.create(tetherSettings);
+ }
+}
+// [END apigeeconnect_v1_generated_tetherclient_create_setcredentialsprovider1_sync]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tetherclient/create/SyncCreateSetEndpoint.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tetherclient/create/SyncCreateSetEndpoint.java
new file mode 100644
index 000000000000..817d02fea152
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tetherclient/create/SyncCreateSetEndpoint.java
@@ -0,0 +1,37 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_tetherclient_create_setendpoint_sync]
+import com.google.cloud.apigeeconnect.v1.TetherClient;
+import com.google.cloud.apigeeconnect.v1.TetherSettings;
+import com.google.cloud.apigeeconnect.v1.myEndpoint;
+
+public class SyncCreateSetEndpoint {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetEndpoint();
+ }
+
+ public static void syncCreateSetEndpoint() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ TetherSettings tetherSettings = TetherSettings.newBuilder().setEndpoint(myEndpoint).build();
+ TetherClient tetherClient = TetherClient.create(tetherSettings);
+ }
+}
+// [END apigeeconnect_v1_generated_tetherclient_create_setendpoint_sync]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tetherclient/egress/AsyncEgress.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tetherclient/egress/AsyncEgress.java
new file mode 100644
index 000000000000..a91cac98b36f
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tetherclient/egress/AsyncEgress.java
@@ -0,0 +1,56 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_tetherclient_egress_async]
+import com.google.api.gax.rpc.BidiStream;
+import com.google.cloud.apigeeconnect.v1.EgressRequest;
+import com.google.cloud.apigeeconnect.v1.EgressResponse;
+import com.google.cloud.apigeeconnect.v1.HttpResponse;
+import com.google.cloud.apigeeconnect.v1.TetherClient;
+import com.google.cloud.apigeeconnect.v1.TetherEndpoint;
+import com.google.rpc.Status;
+
+public class AsyncEgress {
+
+ public static void main(String[] args) throws Exception {
+ asyncEgress();
+ }
+
+ public static void asyncEgress() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (TetherClient tetherClient = TetherClient.create()) {
+ BidiStream bidiStream = tetherClient.egressCallable().call();
+ EgressResponse request =
+ EgressResponse.newBuilder()
+ .setId("id3355")
+ .setHttpResponse(HttpResponse.newBuilder().build())
+ .setStatus(Status.newBuilder().build())
+ .setProject("project-309310695")
+ .setTraceId("traceId-1067401920")
+ .setEndpoint(TetherEndpoint.forNumber(0))
+ .setName("name3373707")
+ .build();
+ bidiStream.send(request);
+ for (EgressRequest response : bidiStream) {
+ // Do something when a response is received.
+ }
+ }
+ }
+}
+// [END apigeeconnect_v1_generated_tetherclient_egress_async]
diff --git a/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tethersettings/egress/SyncEgress.java b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tethersettings/egress/SyncEgress.java
new file mode 100644
index 000000000000..7666eeffdb46
--- /dev/null
+++ b/java-apigee-connect/samples/snippets/generated/com/google/cloud/apigeeconnect/v1/tethersettings/egress/SyncEgress.java
@@ -0,0 +1,45 @@
+/*
+ * 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.cloud.apigeeconnect.v1.samples;
+
+// [START apigeeconnect_v1_generated_tethersettings_egress_sync]
+import com.google.cloud.apigeeconnect.v1.TetherSettings;
+import java.time.Duration;
+
+public class SyncEgress {
+
+ public static void main(String[] args) throws Exception {
+ syncEgress();
+ }
+
+ public static void syncEgress() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ TetherSettings.Builder tetherSettingsBuilder = TetherSettings.newBuilder();
+ tetherSettingsBuilder
+ .egressSettings()
+ .setRetrySettings(
+ tetherSettingsBuilder
+ .egressSettings()
+ .getRetrySettings()
+ .toBuilder()
+ .setTotalTimeout(Duration.ofSeconds(30))
+ .build());
+ TetherSettings tetherSettings = tetherSettingsBuilder.build();
+ }
+}
+// [END apigeeconnect_v1_generated_tethersettings_egress_sync]