diff --git a/google-cloud-vpcaccess/pom.xml b/google-cloud-vpcaccess/pom.xml
index b6c4475a..e9910e70 100644
--- a/google-cloud-vpcaccess/pom.xml
+++ b/google-cloud-vpcaccess/pom.xml
@@ -80,6 +80,11 @@
grpc-google-cloud-vpcaccess-v1test
+
+ com.google.api.grpc
+ grpc-google-common-protos
+ test
+ com.google.api
diff --git a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/VpcAccessServiceClient.java b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/VpcAccessServiceClient.java
index e2057d60..4fd00891 100644
--- a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/VpcAccessServiceClient.java
+++ b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/VpcAccessServiceClient.java
@@ -28,6 +28,9 @@
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.cloud.location.Location;
import com.google.cloud.vpcaccess.v1.stub.VpcAccessServiceStub;
import com.google.cloud.vpcaccess.v1.stub.VpcAccessServiceStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
@@ -722,6 +725,104 @@ public final UnaryCallable deleteConnectorCal
return stub.deleteConnectorCallable();
}
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about the supported locations for this service.
+ *
+ *
Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (Location element : vpcAccessServiceClient.listLocations(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
+ return listLocationsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about the supported locations for this service.
+ *
+ *
Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture future =
+ * vpcAccessServiceClient.listLocationsPagedCallable().futureCall(request);
+ * // Do something.
+ * for (Location element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable
+ listLocationsPagedCallable() {
+ return stub.listLocationsPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about the supported locations for this service.
+ *
+ *
Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListLocationsResponse response =
+ * vpcAccessServiceClient.listLocationsCallable().call(request);
+ * for (Location element : response.getLocationsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable listLocationsCallable() {
+ return stub.listLocationsCallable();
+ }
+
@Override
public final void close() {
stub.close();
@@ -827,4 +928,80 @@ protected ListConnectorsFixedSizeCollection createCollection(
return new ListConnectorsFixedSizeCollection(pages, collectionSize);
}
}
+
+ public static class ListLocationsPagedResponse
+ extends AbstractPagedListResponse<
+ ListLocationsRequest,
+ ListLocationsResponse,
+ Location,
+ ListLocationsPage,
+ ListLocationsFixedSizeCollection> {
+
+ public static ApiFuture createAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ ApiFuture futurePage =
+ ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
+ return ApiFutures.transform(
+ futurePage,
+ input -> new ListLocationsPagedResponse(input),
+ MoreExecutors.directExecutor());
+ }
+
+ private ListLocationsPagedResponse(ListLocationsPage page) {
+ super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
+ }
+ }
+
+ public static class ListLocationsPage
+ extends AbstractPage<
+ ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
+
+ private ListLocationsPage(
+ PageContext context,
+ ListLocationsResponse response) {
+ super(context, response);
+ }
+
+ private static ListLocationsPage createEmptyPage() {
+ return new ListLocationsPage(null, null);
+ }
+
+ @Override
+ protected ListLocationsPage createPage(
+ PageContext context,
+ ListLocationsResponse response) {
+ return new ListLocationsPage(context, response);
+ }
+
+ @Override
+ public ApiFuture createPageAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ return super.createPageAsync(context, futureResponse);
+ }
+ }
+
+ public static class ListLocationsFixedSizeCollection
+ extends AbstractFixedSizeCollection<
+ ListLocationsRequest,
+ ListLocationsResponse,
+ Location,
+ ListLocationsPage,
+ ListLocationsFixedSizeCollection> {
+
+ private ListLocationsFixedSizeCollection(List pages, int collectionSize) {
+ super(pages, collectionSize);
+ }
+
+ private static ListLocationsFixedSizeCollection createEmptyCollection() {
+ return new ListLocationsFixedSizeCollection(null, 0);
+ }
+
+ @Override
+ protected ListLocationsFixedSizeCollection createCollection(
+ List pages, int collectionSize) {
+ return new ListLocationsFixedSizeCollection(pages, collectionSize);
+ }
+ }
}
diff --git a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/VpcAccessServiceSettings.java b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/VpcAccessServiceSettings.java
index b0207fa7..241e6e1d 100644
--- a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/VpcAccessServiceSettings.java
+++ b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/VpcAccessServiceSettings.java
@@ -17,6 +17,7 @@
package com.google.cloud.vpcaccess.v1;
import static com.google.cloud.vpcaccess.v1.VpcAccessServiceClient.ListConnectorsPagedResponse;
+import static com.google.cloud.vpcaccess.v1.VpcAccessServiceClient.ListLocationsPagedResponse;
import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
@@ -31,6 +32,8 @@
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.vpcaccess.v1.stub.VpcAccessServiceStubSettings;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
@@ -109,6 +112,12 @@ public UnaryCallSettings deleteConnectorSetti
return ((VpcAccessServiceStubSettings) getStubSettings()).deleteConnectorOperationSettings();
}
+ /** Returns the object with the settings used for calls to listLocations. */
+ public PagedCallSettings
+ listLocationsSettings() {
+ return ((VpcAccessServiceStubSettings) getStubSettings()).listLocationsSettings();
+ }
+
public static final VpcAccessServiceSettings create(VpcAccessServiceStubSettings stub)
throws IOException {
return new VpcAccessServiceSettings.Builder(stub.toBuilder()).build();
@@ -258,6 +267,13 @@ public UnaryCallSettings.Builder deleteConnec
return getStubSettingsBuilder().deleteConnectorOperationSettings();
}
+ /** Returns the builder for the settings used for calls to listLocations. */
+ public PagedCallSettings.Builder<
+ ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
+ listLocationsSettings() {
+ return getStubSettingsBuilder().listLocationsSettings();
+ }
+
@Override
public VpcAccessServiceSettings build() throws IOException {
return new VpcAccessServiceSettings(this);
diff --git a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/gapic_metadata.json b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/gapic_metadata.json
index 706c30f2..105f48a5 100644
--- a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/gapic_metadata.json
+++ b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/gapic_metadata.json
@@ -21,6 +21,9 @@
},
"ListConnectors": {
"methods": ["listConnectors", "listConnectors", "listConnectors", "listConnectorsPagedCallable", "listConnectorsCallable"]
+ },
+ "ListLocations": {
+ "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
}
}
}
diff --git a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/package-info.java b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/package-info.java
index ad55ba29..221caac9 100644
--- a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/package-info.java
+++ b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/package-info.java
@@ -15,7 +15,9 @@
*/
/**
- * The interfaces provided are listed below, along with usage samples.
+ * A client to Serverless VPC Access API
+ *
+ *
The interfaces provided are listed below, along with usage samples.
*
*
======================= VpcAccessServiceClient =======================
*
diff --git a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/GrpcVpcAccessServiceStub.java b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/GrpcVpcAccessServiceStub.java
index eb7b7474..e7f52bec 100644
--- a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/GrpcVpcAccessServiceStub.java
+++ b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/GrpcVpcAccessServiceStub.java
@@ -17,6 +17,7 @@
package com.google.cloud.vpcaccess.v1.stub;
import static com.google.cloud.vpcaccess.v1.VpcAccessServiceClient.ListConnectorsPagedResponse;
+import static com.google.cloud.vpcaccess.v1.VpcAccessServiceClient.ListLocationsPagedResponse;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
@@ -25,6 +26,8 @@
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.vpcaccess.v1.Connector;
import com.google.cloud.vpcaccess.v1.CreateConnectorRequest;
import com.google.cloud.vpcaccess.v1.DeleteConnectorRequest;
@@ -90,6 +93,17 @@ public class GrpcVpcAccessServiceStub extends VpcAccessServiceStub {
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
+ private static final MethodDescriptor
+ listLocationsMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.location.Locations/ListLocations")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance()))
+ .setResponseMarshaller(
+ ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance()))
+ .build();
+
private final UnaryCallable createConnectorCallable;
private final OperationCallable
createConnectorOperationCallable;
@@ -100,6 +114,9 @@ public class GrpcVpcAccessServiceStub extends VpcAccessServiceStub {
private final UnaryCallable deleteConnectorCallable;
private final OperationCallable
deleteConnectorOperationCallable;
+ private final UnaryCallable listLocationsCallable;
+ private final UnaryCallable
+ listLocationsPagedCallable;
private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
@@ -186,6 +203,16 @@ protected GrpcVpcAccessServiceStub(
return params.build();
})
.build();
+ GrpcCallSettings listLocationsTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(listLocationsMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ ImmutableMap.Builder params = ImmutableMap.builder();
+ params.put("name", String.valueOf(request.getName()));
+ return params.build();
+ })
+ .build();
this.createConnectorCallable =
callableFactory.createUnaryCallable(
@@ -214,6 +241,12 @@ protected GrpcVpcAccessServiceStub(
settings.deleteConnectorOperationSettings(),
clientContext,
operationsStub);
+ this.listLocationsCallable =
+ callableFactory.createUnaryCallable(
+ listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
+ this.listLocationsPagedCallable =
+ callableFactory.createPagedCallable(
+ listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
@@ -261,6 +294,17 @@ public UnaryCallable deleteConnectorCallable(
return deleteConnectorOperationCallable;
}
+ @Override
+ public UnaryCallable listLocationsCallable() {
+ return listLocationsCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listLocationsPagedCallable() {
+ return listLocationsPagedCallable;
+ }
+
@Override
public final void close() {
try {
diff --git a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/HttpJsonVpcAccessServiceStub.java b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/HttpJsonVpcAccessServiceStub.java
index f610e4c6..160e3b46 100644
--- a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/HttpJsonVpcAccessServiceStub.java
+++ b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/HttpJsonVpcAccessServiceStub.java
@@ -17,6 +17,7 @@
package com.google.cloud.vpcaccess.v1.stub;
import static com.google.cloud.vpcaccess.v1.VpcAccessServiceClient.ListConnectorsPagedResponse;
+import static com.google.cloud.vpcaccess.v1.VpcAccessServiceClient.ListLocationsPagedResponse;
import com.google.api.core.BetaApi;
import com.google.api.core.InternalApi;
@@ -33,6 +34,8 @@
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.vpcaccess.v1.Connector;
import com.google.cloud.vpcaccess.v1.CreateConnectorRequest;
import com.google.cloud.vpcaccess.v1.DeleteConnectorRequest;
@@ -212,6 +215,39 @@ public class HttpJsonVpcAccessServiceStub extends VpcAccessServiceStub {
HttpJsonOperationSnapshot.create(response))
.build();
+ private static final ApiMethodDescriptor
+ listLocationsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.location.Locations/ListLocations")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*}/locations",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListLocationsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
private final UnaryCallable createConnectorCallable;
private final OperationCallable
createConnectorOperationCallable;
@@ -222,6 +258,9 @@ public class HttpJsonVpcAccessServiceStub extends VpcAccessServiceStub {
private final UnaryCallable deleteConnectorCallable;
private final OperationCallable
deleteConnectorOperationCallable;
+ private final UnaryCallable listLocationsCallable;
+ private final UnaryCallable
+ listLocationsPagedCallable;
private final BackgroundResource backgroundResources;
private final HttpJsonOperationsStub httpJsonOperationsStub;
@@ -289,6 +328,12 @@ protected HttpJsonVpcAccessServiceStub(
.setMethodDescriptor(deleteConnectorMethodDescriptor)
.setTypeRegistry(typeRegistry)
.build();
+ HttpJsonCallSettings
+ listLocationsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listLocationsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
this.createConnectorCallable =
callableFactory.createUnaryCallable(
@@ -317,6 +362,12 @@ protected HttpJsonVpcAccessServiceStub(
settings.deleteConnectorOperationSettings(),
clientContext,
httpJsonOperationsStub);
+ this.listLocationsCallable =
+ callableFactory.createUnaryCallable(
+ listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
+ this.listLocationsPagedCallable =
+ callableFactory.createPagedCallable(
+ listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
@@ -329,6 +380,7 @@ public static List getMethodDescriptors() {
methodDescriptors.add(getConnectorMethodDescriptor);
methodDescriptors.add(listConnectorsMethodDescriptor);
methodDescriptors.add(deleteConnectorMethodDescriptor);
+ methodDescriptors.add(listLocationsMethodDescriptor);
return methodDescriptors;
}
@@ -374,6 +426,17 @@ public UnaryCallable deleteConnectorCallable(
return deleteConnectorOperationCallable;
}
+ @Override
+ public UnaryCallable listLocationsCallable() {
+ return listLocationsCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listLocationsPagedCallable() {
+ return listLocationsPagedCallable;
+ }
+
@Override
public final void close() {
try {
diff --git a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/VpcAccessServiceStub.java b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/VpcAccessServiceStub.java
index 18d84e28..d92d7f2f 100644
--- a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/VpcAccessServiceStub.java
+++ b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/VpcAccessServiceStub.java
@@ -17,10 +17,13 @@
package com.google.cloud.vpcaccess.v1.stub;
import static com.google.cloud.vpcaccess.v1.VpcAccessServiceClient.ListConnectorsPagedResponse;
+import static com.google.cloud.vpcaccess.v1.VpcAccessServiceClient.ListLocationsPagedResponse;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.vpcaccess.v1.Connector;
import com.google.cloud.vpcaccess.v1.CreateConnectorRequest;
import com.google.cloud.vpcaccess.v1.DeleteConnectorRequest;
@@ -81,6 +84,15 @@ public UnaryCallable deleteConnectorCallable(
throw new UnsupportedOperationException("Not implemented: deleteConnectorCallable()");
}
+ public UnaryCallable
+ listLocationsPagedCallable() {
+ throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
+ }
+
+ public UnaryCallable listLocationsCallable() {
+ throw new UnsupportedOperationException("Not implemented: listLocationsCallable()");
+ }
+
@Override
public abstract void close();
}
diff --git a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/VpcAccessServiceStubSettings.java b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/VpcAccessServiceStubSettings.java
index 01827378..eb6adeb2 100644
--- a/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/VpcAccessServiceStubSettings.java
+++ b/google-cloud-vpcaccess/src/main/java/com/google/cloud/vpcaccess/v1/stub/VpcAccessServiceStubSettings.java
@@ -17,6 +17,7 @@
package com.google.cloud.vpcaccess.v1.stub;
import static com.google.cloud.vpcaccess.v1.VpcAccessServiceClient.ListConnectorsPagedResponse;
+import static com.google.cloud.vpcaccess.v1.VpcAccessServiceClient.ListLocationsPagedResponse;
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
@@ -47,6 +48,9 @@
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.cloud.location.Location;
import com.google.cloud.vpcaccess.v1.Connector;
import com.google.cloud.vpcaccess.v1.CreateConnectorRequest;
import com.google.cloud.vpcaccess.v1.DeleteConnectorRequest;
@@ -115,6 +119,9 @@ public class VpcAccessServiceStubSettings extends StubSettings deleteConnectorSettings;
private final OperationCallSettings
deleteConnectorOperationSettings;
+ private final PagedCallSettings<
+ ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
+ listLocationsSettings;
private static final PagedListDescriptor
LIST_CONNECTORS_PAGE_STR_DESC =
@@ -153,6 +160,42 @@ public Iterable extractResources(ListConnectorsResponse payload) {
}
};
+ private static final PagedListDescriptor
+ LIST_LOCATIONS_PAGE_STR_DESC =
+ new PagedListDescriptor() {
+ @Override
+ public String emptyToken() {
+ return "";
+ }
+
+ @Override
+ public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) {
+ return ListLocationsRequest.newBuilder(payload).setPageToken(token).build();
+ }
+
+ @Override
+ public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) {
+ return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build();
+ }
+
+ @Override
+ public Integer extractPageSize(ListLocationsRequest payload) {
+ return payload.getPageSize();
+ }
+
+ @Override
+ public String extractNextToken(ListLocationsResponse payload) {
+ return payload.getNextPageToken();
+ }
+
+ @Override
+ public Iterable extractResources(ListLocationsResponse payload) {
+ return payload.getLocationsList() == null
+ ? ImmutableList.of()
+ : payload.getLocationsList();
+ }
+ };
+
private static final PagedListResponseFactory<
ListConnectorsRequest, ListConnectorsResponse, ListConnectorsPagedResponse>
LIST_CONNECTORS_PAGE_STR_FACT =
@@ -170,6 +213,23 @@ public ApiFuture getFuturePagedResponse(
}
};
+ private static final PagedListResponseFactory<
+ ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
+ LIST_LOCATIONS_PAGE_STR_FACT =
+ new PagedListResponseFactory<
+ ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() {
+ @Override
+ public ApiFuture getFuturePagedResponse(
+ UnaryCallable callable,
+ ListLocationsRequest request,
+ ApiCallContext context,
+ ApiFuture futureResponse) {
+ PageContext pageContext =
+ PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context);
+ return ListLocationsPagedResponse.createAsync(pageContext, futureResponse);
+ }
+ };
+
/** Returns the object with the settings used for calls to createConnector. */
public UnaryCallSettings createConnectorSettings() {
return createConnectorSettings;
@@ -204,6 +264,12 @@ public UnaryCallSettings deleteConnectorSetti
return deleteConnectorOperationSettings;
}
+ /** Returns the object with the settings used for calls to listLocations. */
+ public PagedCallSettings
+ listLocationsSettings() {
+ return listLocationsSettings;
+ }
+
public VpcAccessServiceStub createStub() throws IOException {
if (getTransportChannelProvider()
.getTransportName()
@@ -316,6 +382,7 @@ protected VpcAccessServiceStubSettings(Builder settingsBuilder) throws IOExcepti
listConnectorsSettings = settingsBuilder.listConnectorsSettings().build();
deleteConnectorSettings = settingsBuilder.deleteConnectorSettings().build();
deleteConnectorOperationSettings = settingsBuilder.deleteConnectorOperationSettings().build();
+ listLocationsSettings = settingsBuilder.listLocationsSettings().build();
}
/** Builder for VpcAccessServiceStubSettings. */
@@ -334,6 +401,9 @@ public static class Builder extends StubSettings.Builder
deleteConnectorOperationSettings;
+ private final PagedCallSettings.Builder<
+ ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
+ listLocationsSettings;
private static final ImmutableMap>
RETRYABLE_CODE_DEFINITIONS;
@@ -342,6 +412,11 @@ public static class Builder extends StubSettings.BuildernewArrayList()));
+ definitions.put(
+ "retry_policy_0_codes",
+ ImmutableSet.copyOf(
+ Lists.newArrayList(
+ StatusCode.Code.UNAVAILABLE, StatusCode.Code.UNKNOWN)));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
@@ -358,6 +433,17 @@ public static class Builder extends StubSettings.Builder>of(
createConnectorSettings,
getConnectorSettings,
listConnectorsSettings,
- deleteConnectorSettings);
+ deleteConnectorSettings,
+ listLocationsSettings);
initDefaults(this);
}
@@ -393,13 +481,15 @@ protected Builder(VpcAccessServiceStubSettings settings) {
listConnectorsSettings = settings.listConnectorsSettings.toBuilder();
deleteConnectorSettings = settings.deleteConnectorSettings.toBuilder();
deleteConnectorOperationSettings = settings.deleteConnectorOperationSettings.toBuilder();
+ listLocationsSettings = settings.listLocationsSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
createConnectorSettings,
getConnectorSettings,
listConnectorsSettings,
- deleteConnectorSettings);
+ deleteConnectorSettings,
+ listLocationsSettings);
}
private static Builder createDefault() {
@@ -449,6 +539,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
+ builder
+ .listLocationsSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
builder
.createConnectorOperationSettings()
.setInitialCallSettings(
@@ -553,6 +648,13 @@ public UnaryCallSettings.Builder deleteConnec
return deleteConnectorOperationSettings;
}
+ /** Returns the builder for the settings used for calls to listLocations. */
+ public PagedCallSettings.Builder<
+ ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
+ listLocationsSettings() {
+ return listLocationsSettings;
+ }
+
@Override
public VpcAccessServiceStubSettings build() throws IOException {
return new VpcAccessServiceStubSettings(this);
diff --git a/google-cloud-vpcaccess/src/test/java/com/google/cloud/vpcaccess/v1/MockLocations.java b/google-cloud-vpcaccess/src/test/java/com/google/cloud/vpcaccess/v1/MockLocations.java
new file mode 100644
index 00000000..2ea202d4
--- /dev/null
+++ b/google-cloud-vpcaccess/src/test/java/com/google/cloud/vpcaccess/v1/MockLocations.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.vpcaccess.v1;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.grpc.testing.MockGrpcService;
+import com.google.protobuf.AbstractMessage;
+import io.grpc.ServerServiceDefinition;
+import java.util.List;
+import javax.annotation.Generated;
+
+@BetaApi
+@Generated("by gapic-generator-java")
+public class MockLocations implements MockGrpcService {
+ private final MockLocationsImpl serviceImpl;
+
+ public MockLocations() {
+ serviceImpl = new MockLocationsImpl();
+ }
+
+ @Override
+ public List getRequests() {
+ return serviceImpl.getRequests();
+ }
+
+ @Override
+ public void addResponse(AbstractMessage response) {
+ serviceImpl.addResponse(response);
+ }
+
+ @Override
+ public void addException(Exception exception) {
+ serviceImpl.addException(exception);
+ }
+
+ @Override
+ public ServerServiceDefinition getServiceDefinition() {
+ return serviceImpl.bindService();
+ }
+
+ @Override
+ public void reset() {
+ serviceImpl.reset();
+ }
+}
diff --git a/google-cloud-vpcaccess/src/test/java/com/google/cloud/vpcaccess/v1/MockLocationsImpl.java b/google-cloud-vpcaccess/src/test/java/com/google/cloud/vpcaccess/v1/MockLocationsImpl.java
new file mode 100644
index 00000000..3df7f0f7
--- /dev/null
+++ b/google-cloud-vpcaccess/src/test/java/com/google/cloud/vpcaccess/v1/MockLocationsImpl.java
@@ -0,0 +1,83 @@
+/*
+ * 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.vpcaccess.v1;
+
+import com.google.api.core.BetaApi;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.cloud.location.LocationsGrpc.LocationsImplBase;
+import com.google.protobuf.AbstractMessage;
+import io.grpc.stub.StreamObserver;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+import javax.annotation.Generated;
+
+@BetaApi
+@Generated("by gapic-generator-java")
+public class MockLocationsImpl extends LocationsImplBase {
+ private List requests;
+ private Queue