- 1.64.0 (latest)
- 1.63.0
- 1.62.0
- 1.61.0
- 1.59.0
- 1.58.0
- 1.57.0
- 1.56.0
- 1.55.0
- 1.54.0
- 1.53.0
- 1.52.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.0
- 1.28.0
- 1.27.0
- 1.26.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.1
- 1.11.0
- 1.9.1
- 1.8.1
- 1.7.2
- 1.6.0-beta
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:
- 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.
- 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.
- 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.
Implements
BackgroundResourceStatic 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.
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 | |
---|---|
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.
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.
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 | |
---|---|
Type | Description |
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 | |
---|---|
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> |