@Generated(value="by gapic-generator-java") public class VpnGatewaysClient 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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String vpnGateway = "vpnGateway1920916144";
VpnGateway response = vpnGatewaysClient.get(project, region, vpnGateway);
}
Note: close() needs to be called on the VpnGatewaysClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
AggregatedList |
Retrieves an aggregated list of VPN gateways. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Delete |
Deletes the specified VPN gateway. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Get |
Returns the specified VPN gateway. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetStatus |
Returns the status for the specified VPN gateway. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Insert |
Creates a VPN gateway in the specified project and region using the data included in the request. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
List |
Retrieves a list of VPN gateways available to the specified project and region. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SetLabels |
Sets the labels on a VpnGateway. To learn more about labels, read the Labeling Resources documentation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
TestIamPermissions |
Returns permissions that a caller has on the specified resource. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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 VpnGatewaysSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
VpnGatewaysSettings vpnGatewaysSettings =
VpnGatewaysSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create(vpnGatewaysSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
VpnGatewaysSettings vpnGatewaysSettings =
VpnGatewaysSettings.newBuilder().setEndpoint(myEndpoint).build();
VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create(vpnGatewaysSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
VpnGatewaysClient.AggregatedListFixedSizeCollection |
static class |
VpnGatewaysClient.AggregatedListPage |
static class |
VpnGatewaysClient.AggregatedListPagedResponse |
static class |
VpnGatewaysClient.ListFixedSizeCollection |
static class |
VpnGatewaysClient.ListPage |
static class |
VpnGatewaysClient.ListPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
VpnGatewaysClient(VpnGatewaysSettings settings)
Constructs an instance of VpnGatewaysClient, using the given settings.
|
protected |
VpnGatewaysClient(VpnGatewaysStub stub) |
| Modifier and Type | Method and Description |
|---|---|
VpnGatewaysClient.AggregatedListPagedResponse |
aggregatedList(AggregatedListVpnGatewaysRequest request)
Retrieves an aggregated list of VPN gateways.
|
VpnGatewaysClient.AggregatedListPagedResponse |
aggregatedList(String project)
Retrieves an aggregated list of VPN gateways.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListVpnGatewaysRequest,VpnGatewayAggregatedList> |
aggregatedListCallable()
Retrieves an aggregated list of VPN gateways.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListVpnGatewaysRequest,VpnGatewaysClient.AggregatedListPagedResponse> |
aggregatedListPagedCallable()
Retrieves an aggregated list of VPN gateways.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static VpnGatewaysClient |
create()
Constructs an instance of VpnGatewaysClient with default settings.
|
static VpnGatewaysClient |
create(VpnGatewaysSettings settings)
Constructs an instance of VpnGatewaysClient, using the given settings.
|
static VpnGatewaysClient |
create(VpnGatewaysStub stub)
Constructs an instance of VpnGatewaysClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
deleteAsync(DeleteVpnGatewayRequest request)
Deletes the specified VPN gateway.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
deleteAsync(String project,
String region,
String vpnGateway)
Deletes the specified VPN gateway.
|
com.google.api.gax.rpc.UnaryCallable<DeleteVpnGatewayRequest,Operation> |
deleteCallable()
Deletes the specified VPN gateway.
|
com.google.api.gax.rpc.OperationCallable<DeleteVpnGatewayRequest,Operation,Operation> |
deleteOperationCallable()
Deletes the specified VPN gateway.
|
VpnGateway |
get(GetVpnGatewayRequest request)
Returns the specified VPN gateway.
|
VpnGateway |
get(String project,
String region,
String vpnGateway)
Returns the specified VPN gateway.
|
com.google.api.gax.rpc.UnaryCallable<GetVpnGatewayRequest,VpnGateway> |
getCallable()
Returns the specified VPN gateway.
|
VpnGatewaysSettings |
getSettings() |
VpnGatewaysGetStatusResponse |
getStatus(GetStatusVpnGatewayRequest request)
Returns the status for the specified VPN gateway.
|
VpnGatewaysGetStatusResponse |
getStatus(String project,
String region,
String vpnGateway)
Returns the status for the specified VPN gateway.
|
com.google.api.gax.rpc.UnaryCallable<GetStatusVpnGatewayRequest,VpnGatewaysGetStatusResponse> |
getStatusCallable()
Returns the status for the specified VPN gateway.
|
VpnGatewaysStub |
getStub() |
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
insertAsync(InsertVpnGatewayRequest request)
Creates a VPN gateway in the specified project and region using the data included in the
request.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
insertAsync(String project,
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<InsertVpnGatewayRequest,Operation> |
insertCallable()
Creates a VPN gateway in the specified project and region using the data included in the
request.
|
com.google.api.gax.rpc.OperationCallable<InsertVpnGatewayRequest,Operation,Operation> |
insertOperationCallable()
Creates a VPN gateway in the specified project and region using the data included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
VpnGatewaysClient.ListPagedResponse |
list(ListVpnGatewaysRequest request)
Retrieves a list of VPN gateways available to the specified project and region.
|
VpnGatewaysClient.ListPagedResponse |
list(String project,
String region)
Retrieves a list of VPN gateways available to the specified project and region.
|
com.google.api.gax.rpc.UnaryCallable<ListVpnGatewaysRequest,VpnGatewayList> |
listCallable()
Retrieves a list of VPN gateways available to the specified project and region.
|
com.google.api.gax.rpc.UnaryCallable<ListVpnGatewaysRequest,VpnGatewaysClient.ListPagedResponse> |
listPagedCallable()
Retrieves a list of VPN gateways available to the specified project and region.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
setLabelsAsync(SetLabelsVpnGatewayRequest request)
Sets the labels on a VpnGateway.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
setLabelsAsync(String project,
String region,
String resource,
RegionSetLabelsRequest regionSetLabelsRequestResource)
Sets the labels on a VpnGateway.
|
com.google.api.gax.rpc.UnaryCallable<SetLabelsVpnGatewayRequest,Operation> |
setLabelsCallable()
Sets the labels on a VpnGateway.
|
com.google.api.gax.rpc.OperationCallable<SetLabelsVpnGatewayRequest,Operation,Operation> |
setLabelsOperationCallable()
Sets the labels on a VpnGateway.
|
void |
shutdown() |
void |
shutdownNow() |
TestPermissionsResponse |
testIamPermissions(String project,
String region,
String resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissions(TestIamPermissionsVpnGatewayRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsVpnGatewayRequest,TestPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
|
protected VpnGatewaysClient(VpnGatewaysSettings settings) throws IOException
IOExceptionprotected VpnGatewaysClient(VpnGatewaysStub stub)
public static final VpnGatewaysClient create() throws IOException
IOExceptionpublic static final VpnGatewaysClient create(VpnGatewaysSettings settings) throws IOException
IOExceptionpublic static final VpnGatewaysClient create(VpnGatewaysStub stub)
public final VpnGatewaysSettings getSettings()
public VpnGatewaysStub getStub()
public final VpnGatewaysClient.AggregatedListPagedResponse aggregatedList(String project)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
String project = "project-309310695";
for (Map.Entry<String, VpnGatewaysScopedList> element :
vpnGatewaysClient.aggregatedList(project).iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final VpnGatewaysClient.AggregatedListPagedResponse aggregatedList(AggregatedListVpnGatewaysRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
AggregatedListVpnGatewaysRequest request =
AggregatedListVpnGatewaysRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setServiceProjectNumber(-1293855239)
.build();
for (Map.Entry<String, VpnGatewaysScopedList> element :
vpnGatewaysClient.aggregatedList(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 failspublic final com.google.api.gax.rpc.UnaryCallable<AggregatedListVpnGatewaysRequest,VpnGatewaysClient.AggregatedListPagedResponse> aggregatedListPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
AggregatedListVpnGatewaysRequest request =
AggregatedListVpnGatewaysRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setServiceProjectNumber(-1293855239)
.build();
ApiFuture<Map.Entry<String, VpnGatewaysScopedList>> future =
vpnGatewaysClient.aggregatedListPagedCallable().futureCall(request);
// Do something.
for (Map.Entry<String, VpnGatewaysScopedList> element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<AggregatedListVpnGatewaysRequest,VpnGatewayAggregatedList> aggregatedListCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
AggregatedListVpnGatewaysRequest request =
AggregatedListVpnGatewaysRequest.newBuilder()
.setFilter("filter-1274492040")
.setIncludeAllScopes(true)
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setServiceProjectNumber(-1293855239)
.build();
while (true) {
VpnGatewayAggregatedList response =
vpnGatewaysClient.aggregatedListCallable().call(request);
for (Map.Entry<String, VpnGatewaysScopedList> element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(String project, String region, String vpnGateway)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String vpnGateway = "vpnGateway1920916144";
Operation response = vpnGatewaysClient.deleteAsync(project, region, vpnGateway).get();
}
project - Project ID for this request.region - Name of the region for this request.vpnGateway - Name of the VPN gateway to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> deleteAsync(DeleteVpnGatewayRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
DeleteVpnGatewayRequest request =
DeleteVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setVpnGateway("vpnGateway1920916144")
.build();
Operation response = vpnGatewaysClient.deleteAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteVpnGatewayRequest,Operation,Operation> deleteOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
DeleteVpnGatewayRequest request =
DeleteVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setVpnGateway("vpnGateway1920916144")
.build();
OperationFuture<Operation, Operation> future =
vpnGatewaysClient.deleteOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteVpnGatewayRequest,Operation> deleteCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
DeleteVpnGatewayRequest request =
DeleteVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setVpnGateway("vpnGateway1920916144")
.build();
ApiFuture<Operation> future = vpnGatewaysClient.deleteCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final VpnGateway get(String project, String region, String vpnGateway)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String vpnGateway = "vpnGateway1920916144";
VpnGateway response = vpnGatewaysClient.get(project, region, vpnGateway);
}
project - Project ID for this request.region - Name of the region for this request.vpnGateway - Name of the VPN gateway to return.com.google.api.gax.rpc.ApiException - if the remote call failspublic final VpnGateway get(GetVpnGatewayRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
GetVpnGatewayRequest request =
GetVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setVpnGateway("vpnGateway1920916144")
.build();
VpnGateway response = vpnGatewaysClient.get(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetVpnGatewayRequest,VpnGateway> getCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
GetVpnGatewayRequest request =
GetVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setVpnGateway("vpnGateway1920916144")
.build();
ApiFuture<VpnGateway> future = vpnGatewaysClient.getCallable().futureCall(request);
// Do something.
VpnGateway response = future.get();
}
public final VpnGatewaysGetStatusResponse getStatus(String project, String region, String vpnGateway)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String vpnGateway = "vpnGateway1920916144";
VpnGatewaysGetStatusResponse response =
vpnGatewaysClient.getStatus(project, region, vpnGateway);
}
project - Project ID for this request.region - Name of the region for this request.vpnGateway - Name of the VPN gateway to return.com.google.api.gax.rpc.ApiException - if the remote call failspublic final VpnGatewaysGetStatusResponse getStatus(GetStatusVpnGatewayRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
GetStatusVpnGatewayRequest request =
GetStatusVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setVpnGateway("vpnGateway1920916144")
.build();
VpnGatewaysGetStatusResponse response = vpnGatewaysClient.getStatus(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetStatusVpnGatewayRequest,VpnGatewaysGetStatusResponse> getStatusCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
GetStatusVpnGatewayRequest request =
GetStatusVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setVpnGateway("vpnGateway1920916144")
.build();
ApiFuture<VpnGatewaysGetStatusResponse> future =
vpnGatewaysClient.getStatusCallable().futureCall(request);
// Do something.
VpnGatewaysGetStatusResponse response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(String project, String region, VpnGateway vpnGatewayResource)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
VpnGateway vpnGatewayResource = VpnGateway.newBuilder().build();
Operation response = vpnGatewaysClient.insertAsync(project, region, vpnGatewayResource).get();
}
project - Project ID for this request.region - Name of the region for this request.vpnGatewayResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> insertAsync(InsertVpnGatewayRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
InsertVpnGatewayRequest request =
InsertVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setVpnGatewayResource(VpnGateway.newBuilder().build())
.build();
Operation response = vpnGatewaysClient.insertAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<InsertVpnGatewayRequest,Operation,Operation> insertOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
InsertVpnGatewayRequest request =
InsertVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setVpnGatewayResource(VpnGateway.newBuilder().build())
.build();
OperationFuture<Operation, Operation> future =
vpnGatewaysClient.insertOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<InsertVpnGatewayRequest,Operation> insertCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
InsertVpnGatewayRequest request =
InsertVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRequestId("requestId693933066")
.setVpnGatewayResource(VpnGateway.newBuilder().build())
.build();
ApiFuture<Operation> future = vpnGatewaysClient.insertCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final VpnGatewaysClient.ListPagedResponse list(String project, String region)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
for (VpnGateway element : vpnGatewaysClient.list(project, region).iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.region - Name of the region for this request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final VpnGatewaysClient.ListPagedResponse list(ListVpnGatewaysRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
ListVpnGatewaysRequest request =
ListVpnGatewaysRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setRegion("region-934795532")
.setReturnPartialSuccess(true)
.build();
for (VpnGateway element : vpnGatewaysClient.list(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 failspublic final com.google.api.gax.rpc.UnaryCallable<ListVpnGatewaysRequest,VpnGatewaysClient.ListPagedResponse> listPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
ListVpnGatewaysRequest request =
ListVpnGatewaysRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setRegion("region-934795532")
.setReturnPartialSuccess(true)
.build();
ApiFuture<VpnGateway> future = vpnGatewaysClient.listPagedCallable().futureCall(request);
// Do something.
for (VpnGateway element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListVpnGatewaysRequest,VpnGatewayList> listCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
ListVpnGatewaysRequest request =
ListVpnGatewaysRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setRegion("region-934795532")
.setReturnPartialSuccess(true)
.build();
while (true) {
VpnGatewayList response = vpnGatewaysClient.listCallable().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;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> setLabelsAsync(String project, String region, String resource, RegionSetLabelsRequest regionSetLabelsRequestResource)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String resource = "resource-341064690";
RegionSetLabelsRequest regionSetLabelsRequestResource =
RegionSetLabelsRequest.newBuilder().build();
Operation response =
vpnGatewaysClient
.setLabelsAsync(project, region, resource, regionSetLabelsRequestResource)
.get();
}
project - Project ID for this request.region - The region for this request.resource - Name or id of the resource for this request.regionSetLabelsRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> setLabelsAsync(SetLabelsVpnGatewayRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
SetLabelsVpnGatewayRequest request =
SetLabelsVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build())
.setRequestId("requestId693933066")
.setResource("resource-341064690")
.build();
Operation response = vpnGatewaysClient.setLabelsAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<SetLabelsVpnGatewayRequest,Operation,Operation> setLabelsOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
SetLabelsVpnGatewayRequest request =
SetLabelsVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build())
.setRequestId("requestId693933066")
.setResource("resource-341064690")
.build();
OperationFuture<Operation, Operation> future =
vpnGatewaysClient.setLabelsOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<SetLabelsVpnGatewayRequest,Operation> setLabelsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
SetLabelsVpnGatewayRequest request =
SetLabelsVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build())
.setRequestId("requestId693933066")
.setResource("resource-341064690")
.build();
ApiFuture<Operation> future = vpnGatewaysClient.setLabelsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final TestPermissionsResponse testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String resource = "resource-341064690";
TestPermissionsRequest testPermissionsRequestResource =
TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response =
vpnGatewaysClient.testIamPermissions(
project, region, resource, testPermissionsRequestResource);
}
project - Project ID for this request.region - The name of the region for this request.resource - Name or id of the resource for this request.testPermissionsRequestResource - The body resource for this requestcom.google.api.gax.rpc.ApiException - if the remote call failspublic final TestPermissionsResponse testIamPermissions(TestIamPermissionsVpnGatewayRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
TestIamPermissionsVpnGatewayRequest request =
TestIamPermissionsVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setResource("resource-341064690")
.setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
.build();
TestPermissionsResponse response = vpnGatewaysClient.testIamPermissions(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsVpnGatewayRequest,TestPermissionsResponse> testIamPermissionsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.create()) {
TestIamPermissionsVpnGatewayRequest request =
TestIamPermissionsVpnGatewayRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setResource("resource-341064690")
.setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
.build();
ApiFuture<TestPermissionsResponse> future =
vpnGatewaysClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestPermissionsResponse response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.