@Generated(value="by gapic-generator") @BetaApi public class TargetVpnGatewayClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
Operation response = targetVpnGatewayClient.deleteTargetVpnGateway(targetVpnGateway);
}
Note: close() needs to be called on the targetVpnGatewayClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of TargetVpnGatewaySettings to create(). For example:
To customize credentials:
TargetVpnGatewaySettings targetVpnGatewaySettings =
TargetVpnGatewaySettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
TargetVpnGatewayClient targetVpnGatewayClient =
TargetVpnGatewayClient.create(targetVpnGatewaySettings);
To customize the endpoint:
TargetVpnGatewaySettings targetVpnGatewaySettings =
TargetVpnGatewaySettings.newBuilder().setEndpoint(myEndpoint).build();
TargetVpnGatewayClient targetVpnGatewayClient =
TargetVpnGatewayClient.create(targetVpnGatewaySettings);
Modifier and Type | Class and Description |
---|---|
static class |
TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysFixedSizeCollection |
static class |
TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPage |
static class |
TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse |
static class |
TargetVpnGatewayClient.ListTargetVpnGatewaysFixedSizeCollection |
static class |
TargetVpnGatewayClient.ListTargetVpnGatewaysPage |
static class |
TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
TargetVpnGatewayClient(TargetVpnGatewaySettings settings)
Constructs an instance of TargetVpnGatewayClient, using the given settings.
|
protected |
TargetVpnGatewayClient(TargetVpnGatewayStub stub) |
Modifier and Type | Method and Description |
---|---|
TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse |
aggregatedListTargetVpnGateways(AggregatedListTargetVpnGatewaysHttpRequest request)
Retrieves an aggregated list of target VPN gateways.
|
TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse |
aggregatedListTargetVpnGateways(ProjectName project)
Retrieves an aggregated list of target VPN gateways.
|
TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse |
aggregatedListTargetVpnGateways(String project)
Retrieves an aggregated list of target VPN gateways.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListTargetVpnGatewaysHttpRequest,TargetVpnGatewayAggregatedList> |
aggregatedListTargetVpnGatewaysCallable()
Retrieves an aggregated list of target VPN gateways.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListTargetVpnGatewaysHttpRequest,TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse> |
aggregatedListTargetVpnGatewaysPagedCallable()
Retrieves an aggregated list of target VPN gateways.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static TargetVpnGatewayClient |
create()
Constructs an instance of TargetVpnGatewayClient with default settings.
|
static TargetVpnGatewayClient |
create(TargetVpnGatewaySettings settings)
Constructs an instance of TargetVpnGatewayClient, using the given settings.
|
static TargetVpnGatewayClient |
create(TargetVpnGatewayStub stub)
Constructs an instance of TargetVpnGatewayClient, using the given stub for making calls.
|
Operation |
deleteTargetVpnGateway(DeleteTargetVpnGatewayHttpRequest request)
Deletes the specified target VPN gateway.
|
Operation |
deleteTargetVpnGateway(ProjectRegionTargetVpnGatewayName targetVpnGateway)
Deletes the specified target VPN gateway.
|
Operation |
deleteTargetVpnGateway(String targetVpnGateway)
Deletes the specified target VPN gateway.
|
com.google.api.gax.rpc.UnaryCallable<DeleteTargetVpnGatewayHttpRequest,Operation> |
deleteTargetVpnGatewayCallable()
Deletes the specified target VPN gateway.
|
TargetVpnGatewaySettings |
getSettings() |
TargetVpnGatewayStub |
getStub() |
TargetVpnGateway |
getTargetVpnGateway(GetTargetVpnGatewayHttpRequest request)
Returns the specified target VPN gateway.
|
TargetVpnGateway |
getTargetVpnGateway(ProjectRegionTargetVpnGatewayName targetVpnGateway)
Returns the specified target VPN gateway.
|
TargetVpnGateway |
getTargetVpnGateway(String targetVpnGateway)
Returns the specified target VPN gateway.
|
com.google.api.gax.rpc.UnaryCallable<GetTargetVpnGatewayHttpRequest,TargetVpnGateway> |
getTargetVpnGatewayCallable()
Returns the specified target VPN gateway.
|
Operation |
insertTargetVpnGateway(InsertTargetVpnGatewayHttpRequest request)
Creates a target VPN gateway in the specified project and region using the data included in the
request.
|
Operation |
insertTargetVpnGateway(ProjectRegionName region,
TargetVpnGateway targetVpnGatewayResource)
Creates a target VPN gateway in the specified project and region using the data included in the
request.
|
Operation |
insertTargetVpnGateway(String region,
TargetVpnGateway targetVpnGatewayResource)
Creates a target VPN gateway in the specified project and region using the data included in the
request.
|
com.google.api.gax.rpc.UnaryCallable<InsertTargetVpnGatewayHttpRequest,Operation> |
insertTargetVpnGatewayCallable()
Creates a target VPN gateway in the specified project and region using the data included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse |
listTargetVpnGateways(ListTargetVpnGatewaysHttpRequest request)
Retrieves a list of target VPN gateways available to the specified project and region.
|
TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse |
listTargetVpnGateways(ProjectRegionName region)
Retrieves a list of target VPN gateways available to the specified project and region.
|
TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse |
listTargetVpnGateways(String region)
Retrieves a list of target VPN gateways available to the specified project and region.
|
com.google.api.gax.rpc.UnaryCallable<ListTargetVpnGatewaysHttpRequest,TargetVpnGatewayList> |
listTargetVpnGatewaysCallable()
Retrieves a list of target VPN gateways available to the specified project and region.
|
com.google.api.gax.rpc.UnaryCallable<ListTargetVpnGatewaysHttpRequest,TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse> |
listTargetVpnGatewaysPagedCallable()
Retrieves a list of target VPN gateways available to the specified project and region.
|
void |
shutdown() |
void |
shutdownNow() |
protected TargetVpnGatewayClient(TargetVpnGatewaySettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected TargetVpnGatewayClient(TargetVpnGatewayStub stub)
public static final TargetVpnGatewayClient create() throws IOException
IOException
public static final TargetVpnGatewayClient create(TargetVpnGatewaySettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final TargetVpnGatewayClient create(TargetVpnGatewayStub stub)
public final TargetVpnGatewaySettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public TargetVpnGatewayStub getStub()
@BetaApi public final TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse aggregatedListTargetVpnGateways(ProjectName project)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (TargetVpnGatewaysScopedList element : targetVpnGatewayClient.aggregatedListTargetVpnGateways(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse aggregatedListTargetVpnGateways(String project)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (TargetVpnGatewaysScopedList element : targetVpnGatewayClient.aggregatedListTargetVpnGateways(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse aggregatedListTargetVpnGateways(AggregatedListTargetVpnGatewaysHttpRequest request)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListTargetVpnGatewaysHttpRequest request = AggregatedListTargetVpnGatewaysHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (TargetVpnGatewaysScopedList element : targetVpnGatewayClient.aggregatedListTargetVpnGateways(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListTargetVpnGatewaysHttpRequest,TargetVpnGatewayClient.AggregatedListTargetVpnGatewaysPagedResponse> aggregatedListTargetVpnGatewaysPagedCallable()
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListTargetVpnGatewaysHttpRequest request = AggregatedListTargetVpnGatewaysHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<AggregatedListTargetVpnGatewaysPagedResponse> future = targetVpnGatewayClient.aggregatedListTargetVpnGatewaysPagedCallable().futureCall(request);
// Do something
for (TargetVpnGatewaysScopedList element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListTargetVpnGatewaysHttpRequest,TargetVpnGatewayAggregatedList> aggregatedListTargetVpnGatewaysCallable()
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListTargetVpnGatewaysHttpRequest request = AggregatedListTargetVpnGatewaysHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
TargetVpnGatewayAggregatedList response = targetVpnGatewayClient.aggregatedListTargetVpnGatewaysCallable().call(request);
for (TargetVpnGatewaysScopedList element : response.getItemsMap()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation deleteTargetVpnGateway(ProjectRegionTargetVpnGatewayName targetVpnGateway)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
Operation response = targetVpnGatewayClient.deleteTargetVpnGateway(targetVpnGateway);
}
targetVpnGateway
- Name of the target VPN gateway to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteTargetVpnGateway(String targetVpnGateway)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
Operation response = targetVpnGatewayClient.deleteTargetVpnGateway(targetVpnGateway.toString());
}
targetVpnGateway
- Name of the target VPN gateway to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteTargetVpnGateway(DeleteTargetVpnGatewayHttpRequest request)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
String formattedTargetVpnGateway = ProjectRegionTargetVpnGatewayName.format("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
DeleteTargetVpnGatewayHttpRequest request = DeleteTargetVpnGatewayHttpRequest.newBuilder()
.setTargetVpnGateway(formattedTargetVpnGateway)
.build();
Operation response = targetVpnGatewayClient.deleteTargetVpnGateway(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeleteTargetVpnGatewayHttpRequest,Operation> deleteTargetVpnGatewayCallable()
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
String formattedTargetVpnGateway = ProjectRegionTargetVpnGatewayName.format("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
DeleteTargetVpnGatewayHttpRequest request = DeleteTargetVpnGatewayHttpRequest.newBuilder()
.setTargetVpnGateway(formattedTargetVpnGateway)
.build();
ApiFuture<Operation> future = targetVpnGatewayClient.deleteTargetVpnGatewayCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TargetVpnGateway getTargetVpnGateway(ProjectRegionTargetVpnGatewayName targetVpnGateway)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
TargetVpnGateway response = targetVpnGatewayClient.getTargetVpnGateway(targetVpnGateway);
}
targetVpnGateway
- Name of the target VPN gateway to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetVpnGateway getTargetVpnGateway(String targetVpnGateway)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
TargetVpnGateway response = targetVpnGatewayClient.getTargetVpnGateway(targetVpnGateway.toString());
}
targetVpnGateway
- Name of the target VPN gateway to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetVpnGateway getTargetVpnGateway(GetTargetVpnGatewayHttpRequest request)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
String formattedTargetVpnGateway = ProjectRegionTargetVpnGatewayName.format("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
GetTargetVpnGatewayHttpRequest request = GetTargetVpnGatewayHttpRequest.newBuilder()
.setTargetVpnGateway(formattedTargetVpnGateway)
.build();
TargetVpnGateway response = targetVpnGatewayClient.getTargetVpnGateway(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetTargetVpnGatewayHttpRequest,TargetVpnGateway> getTargetVpnGatewayCallable()
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
String formattedTargetVpnGateway = ProjectRegionTargetVpnGatewayName.format("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
GetTargetVpnGatewayHttpRequest request = GetTargetVpnGatewayHttpRequest.newBuilder()
.setTargetVpnGateway(formattedTargetVpnGateway)
.build();
ApiFuture<TargetVpnGateway> future = targetVpnGatewayClient.getTargetVpnGatewayCallable().futureCall(request);
// Do something
TargetVpnGateway response = future.get();
}
@BetaApi public final Operation insertTargetVpnGateway(ProjectRegionName region, TargetVpnGateway targetVpnGatewayResource)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
TargetVpnGateway targetVpnGatewayResource = TargetVpnGateway.newBuilder().build();
Operation response = targetVpnGatewayClient.insertTargetVpnGateway(region, targetVpnGatewayResource);
}
region
- Name of the region for this request.targetVpnGatewayResource
- Represents a Target VPN Gateway resource.
The target VPN gateway resource represents a Classic Cloud VPN gateway. For more information, read the the Cloud VPN Overview. (== resource_for beta.targetVpnGateways ==) (== resource_for v1.targetVpnGateways ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertTargetVpnGateway(String region, TargetVpnGateway targetVpnGatewayResource)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
TargetVpnGateway targetVpnGatewayResource = TargetVpnGateway.newBuilder().build();
Operation response = targetVpnGatewayClient.insertTargetVpnGateway(region.toString(), targetVpnGatewayResource);
}
region
- Name of the region for this request.targetVpnGatewayResource
- Represents a Target VPN Gateway resource.
The target VPN gateway resource represents a Classic Cloud VPN gateway. For more information, read the the Cloud VPN Overview. (== resource_for beta.targetVpnGateways ==) (== resource_for v1.targetVpnGateways ==)
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertTargetVpnGateway(InsertTargetVpnGatewayHttpRequest request)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
TargetVpnGateway targetVpnGatewayResource = TargetVpnGateway.newBuilder().build();
InsertTargetVpnGatewayHttpRequest request = InsertTargetVpnGatewayHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setTargetVpnGatewayResource(targetVpnGatewayResource)
.build();
Operation response = targetVpnGatewayClient.insertTargetVpnGateway(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<InsertTargetVpnGatewayHttpRequest,Operation> insertTargetVpnGatewayCallable()
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
TargetVpnGateway targetVpnGatewayResource = TargetVpnGateway.newBuilder().build();
InsertTargetVpnGatewayHttpRequest request = InsertTargetVpnGatewayHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setTargetVpnGatewayResource(targetVpnGatewayResource)
.build();
ApiFuture<Operation> future = targetVpnGatewayClient.insertTargetVpnGatewayCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse listTargetVpnGateways(ProjectRegionName region)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (TargetVpnGateway element : targetVpnGatewayClient.listTargetVpnGateways(region).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse listTargetVpnGateways(String region)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (TargetVpnGateway element : targetVpnGatewayClient.listTargetVpnGateways(region.toString()).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse listTargetVpnGateways(ListTargetVpnGatewaysHttpRequest request)
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListTargetVpnGatewaysHttpRequest request = ListTargetVpnGatewaysHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
for (TargetVpnGateway element : targetVpnGatewayClient.listTargetVpnGateways(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListTargetVpnGatewaysHttpRequest,TargetVpnGatewayClient.ListTargetVpnGatewaysPagedResponse> listTargetVpnGatewaysPagedCallable()
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListTargetVpnGatewaysHttpRequest request = ListTargetVpnGatewaysHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
ApiFuture<ListTargetVpnGatewaysPagedResponse> future = targetVpnGatewayClient.listTargetVpnGatewaysPagedCallable().futureCall(request);
// Do something
for (TargetVpnGateway element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListTargetVpnGatewaysHttpRequest,TargetVpnGatewayList> listTargetVpnGatewaysCallable()
Sample code:
try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListTargetVpnGatewaysHttpRequest request = ListTargetVpnGatewaysHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
while (true) {
TargetVpnGatewayList response = targetVpnGatewayClient.listTargetVpnGatewaysCallable().call(request);
for (TargetVpnGateway element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.