Class VpnGatewaysClient (1.32.0)

public class VpnGatewaysClient implements BackgroundResource

Service Description: The VpnGateways API.

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().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns 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.

Inheritance

java.lang.Object > VpnGatewaysClient

Implements

BackgroundResource

Static Methods

create()

public static final VpnGatewaysClient create()

Constructs an instance of VpnGatewaysClient with default settings.

Returns
TypeDescription
VpnGatewaysClient
Exceptions
TypeDescription
IOException

create(VpnGatewaysSettings settings)

public static final VpnGatewaysClient create(VpnGatewaysSettings settings)

Constructs an instance of VpnGatewaysClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsVpnGatewaysSettings
Returns
TypeDescription
VpnGatewaysClient
Exceptions
TypeDescription
IOException

create(VpnGatewaysStub stub)

public static final VpnGatewaysClient create(VpnGatewaysStub stub)

Constructs an instance of VpnGatewaysClient, using the given stub for making calls. This is for advanced usage - prefer using create(VpnGatewaysSettings).

Parameter
NameDescription
stubVpnGatewaysStub
Returns
TypeDescription
VpnGatewaysClient

Constructors

VpnGatewaysClient(VpnGatewaysSettings settings)

protected VpnGatewaysClient(VpnGatewaysSettings settings)

Constructs an instance of VpnGatewaysClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsVpnGatewaysSettings

VpnGatewaysClient(VpnGatewaysStub stub)

protected VpnGatewaysClient(VpnGatewaysStub stub)
Parameter
NameDescription
stubVpnGatewaysStub

Methods

aggregatedList(AggregatedListVpnGatewaysRequest request)

public final VpnGatewaysClient.AggregatedListPagedResponse aggregatedList(AggregatedListVpnGatewaysRequest request)

Retrieves an aggregated list of VPN gateways.

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)
           .build();
   for (Map.Entry<String, VpnGatewaysScopedList> element :
       vpnGatewaysClient.aggregatedList(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestAggregatedListVpnGatewaysRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
VpnGatewaysClient.AggregatedListPagedResponse

aggregatedList(String project)

public final VpnGatewaysClient.AggregatedListPagedResponse aggregatedList(String project)

Retrieves an aggregated list of VPN gateways.

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);
   }
 }
 
Parameter
NameDescription
projectString

Project ID for this request.

Returns
TypeDescription
VpnGatewaysClient.AggregatedListPagedResponse

aggregatedListCallable()

public final UnaryCallable<AggregatedListVpnGatewaysRequest,VpnGatewayAggregatedList> aggregatedListCallable()

Retrieves an aggregated list of VPN gateways.

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)
           .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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<AggregatedListVpnGatewaysRequest,VpnGatewayAggregatedList>

aggregatedListPagedCallable()

public final UnaryCallable<AggregatedListVpnGatewaysRequest,VpnGatewaysClient.AggregatedListPagedResponse> aggregatedListPagedCallable()

Retrieves an aggregated list of VPN gateways.

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)
           .build();
   ApiFuture<Map.Entry<String, VpnGatewaysScopedList>> future =
       vpnGatewaysClient.aggregatedListPagedCallable().futureCall(request);
   // Do something.
   for (Map.Entry<String, VpnGatewaysScopedList> element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<AggregatedListVpnGatewaysRequest,AggregatedListPagedResponse>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

deleteAsync(DeleteVpnGatewayRequest request)

public final OperationFuture<Operation,Operation> deleteAsync(DeleteVpnGatewayRequest request)

Deletes the specified VPN gateway.

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();
 }
 
Parameter
NameDescription
requestDeleteVpnGatewayRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteAsync(String project, String region, String vpnGateway)

public final OperationFuture<Operation,Operation> deleteAsync(String project, String region, String vpnGateway)

Deletes the specified VPN gateway.

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();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

Name of the region for this request.

vpnGatewayString

Name of the VPN gateway to delete.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteCallable()

public final UnaryCallable<DeleteVpnGatewayRequest,Operation> deleteCallable()

Deletes the specified VPN gateway.

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();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteVpnGatewayRequest,Operation>

deleteOperationCallable()

public final OperationCallable<DeleteVpnGatewayRequest,Operation,Operation> deleteOperationCallable()

Deletes the specified VPN gateway.

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();
 }
 
Returns
TypeDescription
OperationCallable<DeleteVpnGatewayRequest,Operation,Operation>

get(GetVpnGatewayRequest request)

public final VpnGateway get(GetVpnGatewayRequest request)

Returns the specified VPN gateway.

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);
 }
 
Parameter
NameDescription
requestGetVpnGatewayRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
VpnGateway

get(String project, String region, String vpnGateway)

public final VpnGateway get(String project, String region, String vpnGateway)

Returns the specified VPN gateway.

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);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

Name of the region for this request.

vpnGatewayString

Name of the VPN gateway to return.

Returns
TypeDescription
VpnGateway

getCallable()

public final UnaryCallable<GetVpnGatewayRequest,VpnGateway> getCallable()

Returns the specified VPN gateway.

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();
 }
 
Returns
TypeDescription
UnaryCallable<GetVpnGatewayRequest,VpnGateway>

getSettings()

public final VpnGatewaysSettings getSettings()
Returns
TypeDescription
VpnGatewaysSettings

getStatus(GetStatusVpnGatewayRequest request)

public final VpnGatewaysGetStatusResponse getStatus(GetStatusVpnGatewayRequest request)

Returns the status for the specified VPN gateway.

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);
 }
 
Parameter
NameDescription
requestGetStatusVpnGatewayRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
VpnGatewaysGetStatusResponse

getStatus(String project, String region, String vpnGateway)

public final VpnGatewaysGetStatusResponse getStatus(String project, String region, String vpnGateway)

Returns the status for the specified VPN gateway.

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);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

Name of the region for this request.

vpnGatewayString

Name of the VPN gateway to return.

Returns
TypeDescription
VpnGatewaysGetStatusResponse

getStatusCallable()

public final UnaryCallable<GetStatusVpnGatewayRequest,VpnGatewaysGetStatusResponse> getStatusCallable()

Returns the status for the specified VPN gateway.

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();
 }
 
Returns
TypeDescription
UnaryCallable<GetStatusVpnGatewayRequest,VpnGatewaysGetStatusResponse>

getStub()

public VpnGatewaysStub getStub()
Returns
TypeDescription
VpnGatewaysStub

insertAsync(InsertVpnGatewayRequest request)

public final OperationFuture<Operation,Operation> insertAsync(InsertVpnGatewayRequest request)

Creates a VPN gateway in the specified project and region using the data included in the 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();
 }
 
Parameter
NameDescription
requestInsertVpnGatewayRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertAsync(String project, String region, VpnGateway vpnGatewayResource)

public final 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.

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();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

Name of the region for this request.

vpnGatewayResourceVpnGateway

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertCallable()

public final UnaryCallable<InsertVpnGatewayRequest,Operation> insertCallable()

Creates a VPN gateway in the specified project and region using the data included in the 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();
   ApiFuture<Operation> future = vpnGatewaysClient.insertCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<InsertVpnGatewayRequest,Operation>

insertOperationCallable()

public final OperationCallable<InsertVpnGatewayRequest,Operation,Operation> insertOperationCallable()

Creates a VPN gateway in the specified project and region using the data included in the 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();
   OperationFuture<Operation, Operation> future =
       vpnGatewaysClient.insertOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<InsertVpnGatewayRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

list(ListVpnGatewaysRequest request)

public final VpnGatewaysClient.ListPagedResponse list(ListVpnGatewaysRequest request)

Retrieves a list of VPN gateways available to the specified project and 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()) {
   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);
   }
 }
 
Parameter
NameDescription
requestListVpnGatewaysRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
VpnGatewaysClient.ListPagedResponse

list(String project, String region)

public final VpnGatewaysClient.ListPagedResponse list(String project, String region)

Retrieves a list of VPN gateways available to the specified project and 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);
   }
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

Name of the region for this request.

Returns
TypeDescription
VpnGatewaysClient.ListPagedResponse

listCallable()

public final UnaryCallable<ListVpnGatewaysRequest,VpnGatewayList> listCallable()

Retrieves a list of VPN gateways available to the specified project and 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()) {
   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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListVpnGatewaysRequest,VpnGatewayList>

listPagedCallable()

public final UnaryCallable<ListVpnGatewaysRequest,VpnGatewaysClient.ListPagedResponse> listPagedCallable()

Retrieves a list of VPN gateways available to the specified project and 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()) {
   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);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListVpnGatewaysRequest,ListPagedResponse>

setLabelsAsync(SetLabelsVpnGatewayRequest request)

public final OperationFuture<Operation,Operation> setLabelsAsync(SetLabelsVpnGatewayRequest request)

Sets the labels on a VpnGateway. To learn more about labels, read the Labeling Resources documentation.

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();
 }
 
Parameter
NameDescription
requestSetLabelsVpnGatewayRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setLabelsAsync(String project, String region, String resource, RegionSetLabelsRequest regionSetLabelsRequestResource)

public final OperationFuture<Operation,Operation> setLabelsAsync(String project, String region, String resource, RegionSetLabelsRequest regionSetLabelsRequestResource)

Sets the labels on a VpnGateway. To learn more about labels, read the Labeling Resources documentation.

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();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The region for this request.

resourceString

Name or id of the resource for this request.

regionSetLabelsRequestResourceRegionSetLabelsRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setLabelsCallable()

public final UnaryCallable<SetLabelsVpnGatewayRequest,Operation> setLabelsCallable()

Sets the labels on a VpnGateway. To learn more about labels, read the Labeling Resources documentation.

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();
 }
 
Returns
TypeDescription
UnaryCallable<SetLabelsVpnGatewayRequest,Operation>

setLabelsOperationCallable()

public final OperationCallable<SetLabelsVpnGatewayRequest,Operation,Operation> setLabelsOperationCallable()

Sets the labels on a VpnGateway. To learn more about labels, read the Labeling Resources documentation.

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();
 }
 
Returns
TypeDescription
OperationCallable<SetLabelsVpnGatewayRequest,Operation,Operation>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

testIamPermissions(TestIamPermissionsVpnGatewayRequest request)

public final TestPermissionsResponse testIamPermissions(TestIamPermissionsVpnGatewayRequest request)

Returns permissions that a caller has on the specified resource.

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);
 }
 
Parameter
NameDescription
requestTestIamPermissionsVpnGatewayRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TestPermissionsResponse

testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)

public final TestPermissionsResponse testIamPermissions(String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)

Returns permissions that a caller has on the specified resource.

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);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

regionString

The name of the region for this request.

resourceString

Name or id of the resource for this request.

testPermissionsRequestResourceTestPermissionsRequest

The body resource for this request

Returns
TypeDescription
TestPermissionsResponse

testIamPermissionsCallable()

public final UnaryCallable<TestIamPermissionsVpnGatewayRequest,TestPermissionsResponse> testIamPermissionsCallable()

Returns permissions that a caller has on the specified resource.

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();
 }
 
Returns
TypeDescription
UnaryCallable<TestIamPermissionsVpnGatewayRequest,TestPermissionsResponse>