@Generated(value="by gapic-generator") @BetaApi public class VpnGatewayClient 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 (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionVpnGatewayName vpnGateway = ProjectRegionVpnGatewayName.of("[PROJECT]", "[REGION]", "[VPN_GATEWAY]");
Operation response = vpnGatewayClient.deleteVpnGateway(vpnGateway);
}
Note: close() needs to be called on the vpnGatewayClient 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 VpnGatewaySettings to create(). For example:
To customize credentials:
VpnGatewaySettings vpnGatewaySettings =
VpnGatewaySettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
VpnGatewayClient vpnGatewayClient =
VpnGatewayClient.create(vpnGatewaySettings);
To customize the endpoint:
VpnGatewaySettings vpnGatewaySettings =
VpnGatewaySettings.newBuilder().setEndpoint(myEndpoint).build();
VpnGatewayClient vpnGatewayClient =
VpnGatewayClient.create(vpnGatewaySettings);
Modifier and Type | Class and Description |
---|---|
static class |
VpnGatewayClient.AggregatedListVpnGatewaysFixedSizeCollection |
static class |
VpnGatewayClient.AggregatedListVpnGatewaysPage |
static class |
VpnGatewayClient.AggregatedListVpnGatewaysPagedResponse |
static class |
VpnGatewayClient.ListVpnGatewaysFixedSizeCollection |
static class |
VpnGatewayClient.ListVpnGatewaysPage |
static class |
VpnGatewayClient.ListVpnGatewaysPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
VpnGatewayClient(VpnGatewaySettings settings)
Constructs an instance of VpnGatewayClient, using the given settings.
|
protected |
VpnGatewayClient(VpnGatewayStub stub) |
Modifier and Type | Method and Description |
---|---|
VpnGatewayClient.AggregatedListVpnGatewaysPagedResponse |
aggregatedListVpnGateways(AggregatedListVpnGatewaysHttpRequest request)
Retrieves an aggregated list of VPN gateways.
|
VpnGatewayClient.AggregatedListVpnGatewaysPagedResponse |
aggregatedListVpnGateways(ProjectName project)
Retrieves an aggregated list of VPN gateways.
|
VpnGatewayClient.AggregatedListVpnGatewaysPagedResponse |
aggregatedListVpnGateways(String project)
Retrieves an aggregated list of VPN gateways.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListVpnGatewaysHttpRequest,VpnGatewayAggregatedList> |
aggregatedListVpnGatewaysCallable()
Retrieves an aggregated list of VPN gateways.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListVpnGatewaysHttpRequest,VpnGatewayClient.AggregatedListVpnGatewaysPagedResponse> |
aggregatedListVpnGatewaysPagedCallable()
Retrieves an aggregated list of VPN gateways.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static VpnGatewayClient |
create()
Constructs an instance of VpnGatewayClient with default settings.
|
static VpnGatewayClient |
create(VpnGatewaySettings settings)
Constructs an instance of VpnGatewayClient, using the given settings.
|
static VpnGatewayClient |
create(VpnGatewayStub stub)
Constructs an instance of VpnGatewayClient, using the given stub for making calls.
|
Operation |
deleteVpnGateway(DeleteVpnGatewayHttpRequest request)
Deletes the specified VPN gateway.
|
Operation |
deleteVpnGateway(ProjectRegionVpnGatewayName vpnGateway)
Deletes the specified VPN gateway.
|
Operation |
deleteVpnGateway(String vpnGateway)
Deletes the specified VPN gateway.
|
com.google.api.gax.rpc.UnaryCallable<DeleteVpnGatewayHttpRequest,Operation> |
deleteVpnGatewayCallable()
Deletes the specified VPN gateway.
|
VpnGatewaySettings |
getSettings() |
VpnGatewaysGetStatusResponse |
getStatusVpnGateway(GetStatusVpnGatewayHttpRequest request)
Returns the status for the specified VPN gateway.
|
VpnGatewaysGetStatusResponse |
getStatusVpnGateway(ProjectRegionVpnGatewayName vpnGateway)
Returns the status for the specified VPN gateway.
|
VpnGatewaysGetStatusResponse |
getStatusVpnGateway(String vpnGateway)
Returns the status for the specified VPN gateway.
|
com.google.api.gax.rpc.UnaryCallable<GetStatusVpnGatewayHttpRequest,VpnGatewaysGetStatusResponse> |
getStatusVpnGatewayCallable()
Returns the status for the specified VPN gateway.
|
VpnGatewayStub |
getStub() |
VpnGateway |
getVpnGateway(GetVpnGatewayHttpRequest request)
Returns the specified VPN gateway.
|
VpnGateway |
getVpnGateway(ProjectRegionVpnGatewayName vpnGateway)
Returns the specified VPN gateway.
|
VpnGateway |
getVpnGateway(String vpnGateway)
Returns the specified VPN gateway.
|
com.google.api.gax.rpc.UnaryCallable<GetVpnGatewayHttpRequest,VpnGateway> |
getVpnGatewayCallable()
Returns the specified VPN gateway.
|
Operation |
insertVpnGateway(InsertVpnGatewayHttpRequest request)
Creates a VPN gateway in the specified project and region using the data included in the
request.
|
Operation |
insertVpnGateway(ProjectRegionName region,
VpnGateway vpnGatewayResource)
Creates a VPN gateway in the specified project and region using the data included in the
request.
|
Operation |
insertVpnGateway(String region,
VpnGateway vpnGatewayResource)
Creates a VPN gateway in the specified project and region using the data included in the
request.
|
com.google.api.gax.rpc.UnaryCallable<InsertVpnGatewayHttpRequest,Operation> |
insertVpnGatewayCallable()
Creates a VPN gateway in the specified project and region using the data included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
VpnGatewayClient.ListVpnGatewaysPagedResponse |
listVpnGateways(ListVpnGatewaysHttpRequest request)
Retrieves a list of VPN gateways available to the specified project and region.
|
VpnGatewayClient.ListVpnGatewaysPagedResponse |
listVpnGateways(ProjectRegionName region)
Retrieves a list of VPN gateways available to the specified project and region.
|
VpnGatewayClient.ListVpnGatewaysPagedResponse |
listVpnGateways(String region)
Retrieves a list of VPN gateways available to the specified project and region.
|
com.google.api.gax.rpc.UnaryCallable<ListVpnGatewaysHttpRequest,VpnGatewayList> |
listVpnGatewaysCallable()
Retrieves a list of VPN gateways available to the specified project and region.
|
com.google.api.gax.rpc.UnaryCallable<ListVpnGatewaysHttpRequest,VpnGatewayClient.ListVpnGatewaysPagedResponse> |
listVpnGatewaysPagedCallable()
Retrieves a list of VPN gateways available to the specified project and region.
|
Operation |
setLabelsVpnGateway(ProjectRegionVpnGatewayResourceName resource,
RegionSetLabelsRequest regionSetLabelsRequestResource)
Sets the labels on a VpnGateway.
|
Operation |
setLabelsVpnGateway(SetLabelsVpnGatewayHttpRequest request)
Sets the labels on a VpnGateway.
|
Operation |
setLabelsVpnGateway(String resource,
RegionSetLabelsRequest regionSetLabelsRequestResource)
Sets the labels on a VpnGateway.
|
com.google.api.gax.rpc.UnaryCallable<SetLabelsVpnGatewayHttpRequest,Operation> |
setLabelsVpnGatewayCallable()
Sets the labels on a VpnGateway.
|
void |
shutdown() |
void |
shutdownNow() |
TestPermissionsResponse |
testIamPermissionsVpnGateway(ProjectRegionVpnGatewayResourceName resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsVpnGateway(String resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsVpnGateway(TestIamPermissionsVpnGatewayHttpRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsVpnGatewayHttpRequest,TestPermissionsResponse> |
testIamPermissionsVpnGatewayCallable()
Returns permissions that a caller has on the specified resource.
|
protected VpnGatewayClient(VpnGatewaySettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected VpnGatewayClient(VpnGatewayStub stub)
public static final VpnGatewayClient create() throws IOException
IOException
public static final VpnGatewayClient create(VpnGatewaySettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final VpnGatewayClient create(VpnGatewayStub stub)
public final VpnGatewaySettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public VpnGatewayStub getStub()
@BetaApi public final VpnGatewayClient.AggregatedListVpnGatewaysPagedResponse aggregatedListVpnGateways(ProjectName project)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (VpnGatewaysScopedList element : vpnGatewayClient.aggregatedListVpnGateways(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final VpnGatewayClient.AggregatedListVpnGatewaysPagedResponse aggregatedListVpnGateways(String project)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (VpnGatewaysScopedList element : vpnGatewayClient.aggregatedListVpnGateways(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 VpnGatewayClient.AggregatedListVpnGatewaysPagedResponse aggregatedListVpnGateways(AggregatedListVpnGatewaysHttpRequest request)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListVpnGatewaysHttpRequest request = AggregatedListVpnGatewaysHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (VpnGatewaysScopedList element : vpnGatewayClient.aggregatedListVpnGateways(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<AggregatedListVpnGatewaysHttpRequest,VpnGatewayClient.AggregatedListVpnGatewaysPagedResponse> aggregatedListVpnGatewaysPagedCallable()
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListVpnGatewaysHttpRequest request = AggregatedListVpnGatewaysHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<AggregatedListVpnGatewaysPagedResponse> future = vpnGatewayClient.aggregatedListVpnGatewaysPagedCallable().futureCall(request);
// Do something
for (VpnGatewaysScopedList element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListVpnGatewaysHttpRequest,VpnGatewayAggregatedList> aggregatedListVpnGatewaysCallable()
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListVpnGatewaysHttpRequest request = AggregatedListVpnGatewaysHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
VpnGatewayAggregatedList response = vpnGatewayClient.aggregatedListVpnGatewaysCallable().call(request);
for (VpnGatewaysScopedList 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 deleteVpnGateway(ProjectRegionVpnGatewayName vpnGateway)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionVpnGatewayName vpnGateway = ProjectRegionVpnGatewayName.of("[PROJECT]", "[REGION]", "[VPN_GATEWAY]");
Operation response = vpnGatewayClient.deleteVpnGateway(vpnGateway);
}
vpnGateway
- Name of the VPN gateway to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteVpnGateway(String vpnGateway)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionVpnGatewayName vpnGateway = ProjectRegionVpnGatewayName.of("[PROJECT]", "[REGION]", "[VPN_GATEWAY]");
Operation response = vpnGatewayClient.deleteVpnGateway(vpnGateway.toString());
}
vpnGateway
- Name of the VPN gateway to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteVpnGateway(DeleteVpnGatewayHttpRequest request)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedVpnGateway = ProjectRegionVpnGatewayName.format("[PROJECT]", "[REGION]", "[VPN_GATEWAY]");
DeleteVpnGatewayHttpRequest request = DeleteVpnGatewayHttpRequest.newBuilder()
.setVpnGateway(formattedVpnGateway)
.build();
Operation response = vpnGatewayClient.deleteVpnGateway(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<DeleteVpnGatewayHttpRequest,Operation> deleteVpnGatewayCallable()
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedVpnGateway = ProjectRegionVpnGatewayName.format("[PROJECT]", "[REGION]", "[VPN_GATEWAY]");
DeleteVpnGatewayHttpRequest request = DeleteVpnGatewayHttpRequest.newBuilder()
.setVpnGateway(formattedVpnGateway)
.build();
ApiFuture<Operation> future = vpnGatewayClient.deleteVpnGatewayCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final VpnGateway getVpnGateway(ProjectRegionVpnGatewayName vpnGateway)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionVpnGatewayName vpnGateway = ProjectRegionVpnGatewayName.of("[PROJECT]", "[REGION]", "[VPN_GATEWAY]");
VpnGateway response = vpnGatewayClient.getVpnGateway(vpnGateway);
}
vpnGateway
- Name of the VPN gateway to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final VpnGateway getVpnGateway(String vpnGateway)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionVpnGatewayName vpnGateway = ProjectRegionVpnGatewayName.of("[PROJECT]", "[REGION]", "[VPN_GATEWAY]");
VpnGateway response = vpnGatewayClient.getVpnGateway(vpnGateway.toString());
}
vpnGateway
- Name of the VPN gateway to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final VpnGateway getVpnGateway(GetVpnGatewayHttpRequest request)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedVpnGateway = ProjectRegionVpnGatewayName.format("[PROJECT]", "[REGION]", "[VPN_GATEWAY]");
GetVpnGatewayHttpRequest request = GetVpnGatewayHttpRequest.newBuilder()
.setVpnGateway(formattedVpnGateway)
.build();
VpnGateway response = vpnGatewayClient.getVpnGateway(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<GetVpnGatewayHttpRequest,VpnGateway> getVpnGatewayCallable()
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedVpnGateway = ProjectRegionVpnGatewayName.format("[PROJECT]", "[REGION]", "[VPN_GATEWAY]");
GetVpnGatewayHttpRequest request = GetVpnGatewayHttpRequest.newBuilder()
.setVpnGateway(formattedVpnGateway)
.build();
ApiFuture<VpnGateway> future = vpnGatewayClient.getVpnGatewayCallable().futureCall(request);
// Do something
VpnGateway response = future.get();
}
@BetaApi public final VpnGatewaysGetStatusResponse getStatusVpnGateway(ProjectRegionVpnGatewayName vpnGateway)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionVpnGatewayName vpnGateway = ProjectRegionVpnGatewayName.of("[PROJECT]", "[REGION]", "[VPN_GATEWAY]");
VpnGatewaysGetStatusResponse response = vpnGatewayClient.getStatusVpnGateway(vpnGateway);
}
vpnGateway
- Name of the VPN gateway to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final VpnGatewaysGetStatusResponse getStatusVpnGateway(String vpnGateway)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionVpnGatewayName vpnGateway = ProjectRegionVpnGatewayName.of("[PROJECT]", "[REGION]", "[VPN_GATEWAY]");
VpnGatewaysGetStatusResponse response = vpnGatewayClient.getStatusVpnGateway(vpnGateway.toString());
}
vpnGateway
- Name of the VPN gateway to return.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final VpnGatewaysGetStatusResponse getStatusVpnGateway(GetStatusVpnGatewayHttpRequest request)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedVpnGateway = ProjectRegionVpnGatewayName.format("[PROJECT]", "[REGION]", "[VPN_GATEWAY]");
GetStatusVpnGatewayHttpRequest request = GetStatusVpnGatewayHttpRequest.newBuilder()
.setVpnGateway(formattedVpnGateway)
.build();
VpnGatewaysGetStatusResponse response = vpnGatewayClient.getStatusVpnGateway(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<GetStatusVpnGatewayHttpRequest,VpnGatewaysGetStatusResponse> getStatusVpnGatewayCallable()
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedVpnGateway = ProjectRegionVpnGatewayName.format("[PROJECT]", "[REGION]", "[VPN_GATEWAY]");
GetStatusVpnGatewayHttpRequest request = GetStatusVpnGatewayHttpRequest.newBuilder()
.setVpnGateway(formattedVpnGateway)
.build();
ApiFuture<VpnGatewaysGetStatusResponse> future = vpnGatewayClient.getStatusVpnGatewayCallable().futureCall(request);
// Do something
VpnGatewaysGetStatusResponse response = future.get();
}
@BetaApi public final Operation insertVpnGateway(ProjectRegionName region, VpnGateway vpnGatewayResource)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
VpnGateway vpnGatewayResource = VpnGateway.newBuilder().build();
Operation response = vpnGatewayClient.insertVpnGateway(region, vpnGatewayResource);
}
region
- Name of the region for this request.vpnGatewayResource
- Represents a VPN gateway resource.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertVpnGateway(String region, VpnGateway vpnGatewayResource)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
VpnGateway vpnGatewayResource = VpnGateway.newBuilder().build();
Operation response = vpnGatewayClient.insertVpnGateway(region.toString(), vpnGatewayResource);
}
region
- Name of the region for this request.vpnGatewayResource
- Represents a VPN gateway resource.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertVpnGateway(InsertVpnGatewayHttpRequest request)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
VpnGateway vpnGatewayResource = VpnGateway.newBuilder().build();
InsertVpnGatewayHttpRequest request = InsertVpnGatewayHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setVpnGatewayResource(vpnGatewayResource)
.build();
Operation response = vpnGatewayClient.insertVpnGateway(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<InsertVpnGatewayHttpRequest,Operation> insertVpnGatewayCallable()
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
VpnGateway vpnGatewayResource = VpnGateway.newBuilder().build();
InsertVpnGatewayHttpRequest request = InsertVpnGatewayHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setVpnGatewayResource(vpnGatewayResource)
.build();
ApiFuture<Operation> future = vpnGatewayClient.insertVpnGatewayCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final VpnGatewayClient.ListVpnGatewaysPagedResponse listVpnGateways(ProjectRegionName region)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (VpnGateway element : vpnGatewayClient.listVpnGateways(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 VpnGatewayClient.ListVpnGatewaysPagedResponse listVpnGateways(String region)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (VpnGateway element : vpnGatewayClient.listVpnGateways(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 VpnGatewayClient.ListVpnGatewaysPagedResponse listVpnGateways(ListVpnGatewaysHttpRequest request)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListVpnGatewaysHttpRequest request = ListVpnGatewaysHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
for (VpnGateway element : vpnGatewayClient.listVpnGateways(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<ListVpnGatewaysHttpRequest,VpnGatewayClient.ListVpnGatewaysPagedResponse> listVpnGatewaysPagedCallable()
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListVpnGatewaysHttpRequest request = ListVpnGatewaysHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
ApiFuture<ListVpnGatewaysPagedResponse> future = vpnGatewayClient.listVpnGatewaysPagedCallable().futureCall(request);
// Do something
for (VpnGateway element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListVpnGatewaysHttpRequest,VpnGatewayList> listVpnGatewaysCallable()
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListVpnGatewaysHttpRequest request = ListVpnGatewaysHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
while (true) {
VpnGatewayList response = vpnGatewayClient.listVpnGatewaysCallable().call(request);
for (VpnGateway element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation setLabelsVpnGateway(ProjectRegionVpnGatewayResourceName resource, RegionSetLabelsRequest regionSetLabelsRequestResource)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionVpnGatewayResourceName resource = ProjectRegionVpnGatewayResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetLabelsRequest regionSetLabelsRequestResource = RegionSetLabelsRequest.newBuilder().build();
Operation response = vpnGatewayClient.setLabelsVpnGateway(resource, regionSetLabelsRequestResource);
}
resource
- Name or id of the resource for this request.regionSetLabelsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setLabelsVpnGateway(String resource, RegionSetLabelsRequest regionSetLabelsRequestResource)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionVpnGatewayResourceName resource = ProjectRegionVpnGatewayResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetLabelsRequest regionSetLabelsRequestResource = RegionSetLabelsRequest.newBuilder().build();
Operation response = vpnGatewayClient.setLabelsVpnGateway(resource.toString(), regionSetLabelsRequestResource);
}
resource
- Name or id of the resource for this request.regionSetLabelsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation setLabelsVpnGateway(SetLabelsVpnGatewayHttpRequest request)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedResource = ProjectRegionVpnGatewayResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetLabelsRequest regionSetLabelsRequestResource = RegionSetLabelsRequest.newBuilder().build();
SetLabelsVpnGatewayHttpRequest request = SetLabelsVpnGatewayHttpRequest.newBuilder()
.setResource(formattedResource)
.setRegionSetLabelsRequestResource(regionSetLabelsRequestResource)
.build();
Operation response = vpnGatewayClient.setLabelsVpnGateway(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<SetLabelsVpnGatewayHttpRequest,Operation> setLabelsVpnGatewayCallable()
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedResource = ProjectRegionVpnGatewayResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
RegionSetLabelsRequest regionSetLabelsRequestResource = RegionSetLabelsRequest.newBuilder().build();
SetLabelsVpnGatewayHttpRequest request = SetLabelsVpnGatewayHttpRequest.newBuilder()
.setResource(formattedResource)
.setRegionSetLabelsRequestResource(regionSetLabelsRequestResource)
.build();
ApiFuture<Operation> future = vpnGatewayClient.setLabelsVpnGatewayCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final TestPermissionsResponse testIamPermissionsVpnGateway(ProjectRegionVpnGatewayResourceName resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionVpnGatewayResourceName resource = ProjectRegionVpnGatewayResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = vpnGatewayClient.testIamPermissionsVpnGateway(resource, testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsVpnGateway(String resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
ProjectRegionVpnGatewayResourceName resource = ProjectRegionVpnGatewayResourceName.of("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = vpnGatewayClient.testIamPermissionsVpnGateway(resource.toString(), testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsVpnGateway(TestIamPermissionsVpnGatewayHttpRequest request)
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedResource = ProjectRegionVpnGatewayResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsVpnGatewayHttpRequest request = TestIamPermissionsVpnGatewayHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
TestPermissionsResponse response = vpnGatewayClient.testIamPermissionsVpnGateway(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<TestIamPermissionsVpnGatewayHttpRequest,TestPermissionsResponse> testIamPermissionsVpnGatewayCallable()
Sample code:
try (VpnGatewayClient vpnGatewayClient = VpnGatewayClient.create()) {
String formattedResource = ProjectRegionVpnGatewayResourceName.format("[PROJECT]", "[REGION]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsVpnGatewayHttpRequest request = TestIamPermissionsVpnGatewayHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
ApiFuture<TestPermissionsResponse> future = vpnGatewayClient.testIamPermissionsVpnGatewayCallable().futureCall(request);
// Do something
TestPermissionsResponse response = future.get();
}
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.