Class VpnGatewaysClient (1.52.0)

GitHub RepositoryProduct Reference

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

Methods
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.

  • aggregatedList(AggregatedListVpnGatewaysRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • aggregatedList(String project)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • aggregatedListPagedCallable()

  • aggregatedListCallable()

Delete

Deletes the specified VPN gateway.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteAsync(DeleteVpnGatewayRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteAsync(String project, String region, String vpnGateway)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteOperationCallable()

  • deleteCallable()

Get

Returns the specified VPN gateway.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • get(GetVpnGatewayRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • get(String project, String region, String vpnGateway)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getCallable()

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.

  • getStatus(GetStatusVpnGatewayRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getStatus(String project, String region, String vpnGateway)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getStatusCallable()

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.

  • insertAsync(InsertVpnGatewayRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • insertAsync(String project, String region, VpnGateway vpnGatewayResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • insertOperationCallable()

  • insertCallable()

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.

  • list(ListVpnGatewaysRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • list(String project, String region)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listPagedCallable()

  • listCallable()

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.

  • setLabelsAsync(SetLabelsVpnGatewayRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

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

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • setLabelsOperationCallable()

  • setLabelsCallable()

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.

  • testIamPermissions(TestIamPermissionsVpnGatewayRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

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

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • testIamPermissionsCallable()

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

Static Methods

create()

public static final VpnGatewaysClient create()

Constructs an instance of VpnGatewaysClient with default settings.

Returns
Type Description
VpnGatewaysClient
Exceptions
Type Description
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
Name Description
settings VpnGatewaysSettings
Returns
Type Description
VpnGatewaysClient
Exceptions
Type Description
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
Name Description
stub VpnGatewaysStub
Returns
Type Description
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
Name Description
settings VpnGatewaysSettings

VpnGatewaysClient(VpnGatewaysStub stub)

protected VpnGatewaysClient(VpnGatewaysStub stub)
Parameter
Name Description
stub VpnGatewaysStub

Methods

aggregatedList(AggregatedListVpnGatewaysRequest request)

public final VpnGatewaysClient.AggregatedListPagedResponse aggregatedList(AggregatedListVpnGatewaysRequest request)

Retrieves an aggregated list of VPN gateways. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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);
   }
 }
 
Parameter
Name Description
request AggregatedListVpnGatewaysRequest

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

Returns
Type Description
VpnGatewaysClient.AggregatedListPagedResponse

aggregatedList(String project)

public final VpnGatewaysClient.AggregatedListPagedResponse aggregatedList(String project)

Retrieves an aggregated list of VPN gateways. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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
Name Description
project String

Project ID for this request.

Returns
Type Description
VpnGatewaysClient.AggregatedListPagedResponse

aggregatedListCallable()

public final UnaryCallable<AggregatedListVpnGatewaysRequest,VpnGatewayAggregatedList> aggregatedListCallable()

Retrieves an aggregated list of VPN gateways. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<AggregatedListVpnGatewaysRequest,VpnGatewayAggregatedList>

aggregatedListPagedCallable()

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

Retrieves an aggregated list of VPN gateways. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

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);
   }
 }
 
Returns
Type Description
UnaryCallable<AggregatedListVpnGatewaysRequest,AggregatedListPagedResponse>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
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
Name Description
request DeleteVpnGatewayRequest

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

Returns
Type Description
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
Name Description
project String

Project ID for this request.

region String

Name of the region for this request.

vpnGateway String

Name of the VPN gateway to delete.

Returns
Type Description
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
Type Description
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
Type Description
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
Name Description
request GetVpnGatewayRequest

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

Returns
Type Description
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
Name Description
project String

Project ID for this request.

region String

Name of the region for this request.

vpnGateway String

Name of the VPN gateway to return.

Returns
Type Description
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
Type Description
UnaryCallable<GetVpnGatewayRequest,VpnGateway>

getSettings()

public final VpnGatewaysSettings getSettings()
Returns
Type Description
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
Name Description
request GetStatusVpnGatewayRequest

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

Returns
Type Description
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
Name Description
project String

Project ID for this request.

region String

Name of the region for this request.

vpnGateway String

Name of the VPN gateway to return.

Returns
Type Description
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
Type Description
UnaryCallable<GetStatusVpnGatewayRequest,VpnGatewaysGetStatusResponse>

getStub()

public VpnGatewaysStub getStub()
Returns
Type Description
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
Name Description
request InsertVpnGatewayRequest

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

Returns
Type Description
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
Name Description
project String

Project ID for this request.

region String

Name of the region for this request.

vpnGatewayResource VpnGateway

The body resource for this request

Returns
Type Description
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
Type Description
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
Type Description
OperationCallable<InsertVpnGatewayRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
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
Name Description
request ListVpnGatewaysRequest

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

Returns
Type Description
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
Name Description
project String

Project ID for this request.

region String

Name of the region for this request.

Returns
Type Description
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
Type Description
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
Type Description
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
Name Description
request SetLabelsVpnGatewayRequest

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

Returns
Type Description
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
Name Description
project String

Project ID for this request.

region String

The region for this request.

resource String

Name or id of the resource for this request.

regionSetLabelsRequestResource RegionSetLabelsRequest

The body resource for this request

Returns
Type Description
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
Type Description
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
Type Description
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
Name Description
request TestIamPermissionsVpnGatewayRequest

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

Returns
Type Description
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
Name Description
project String

Project ID for this request.

region String

The name of the region for this request.

resource String

Name or id of the resource for this request.

testPermissionsRequestResource TestPermissionsRequest

The body resource for this request

Returns
Type Description
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
Type Description
UnaryCallable<TestIamPermissionsVpnGatewayRequest,TestPermissionsResponse>