Class VpcAccessServiceClient (2.29.0)

public class VpcAccessServiceClient implements BackgroundResource

Service Description: Serverless VPC Access API allows users to create and manage connectors for App Engine, Cloud Functions and Cloud Run to have internal connections to Virtual Private Cloud networks.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   ConnectorName name = ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECTOR]");
   Connector response = vpcAccessServiceClient.getConnector(name);
 }
 

Note: close() needs to be called on the VpcAccessServiceClient 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 VpcAccessServiceSettings 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
 VpcAccessServiceSettings vpcAccessServiceSettings =
     VpcAccessServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 VpcAccessServiceClient vpcAccessServiceClient =
     VpcAccessServiceClient.create(vpcAccessServiceSettings);
 

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
 VpcAccessServiceSettings vpcAccessServiceSettings =
     VpcAccessServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 VpcAccessServiceClient vpcAccessServiceClient =
     VpcAccessServiceClient.create(vpcAccessServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // 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
 VpcAccessServiceSettings vpcAccessServiceSettings =
     VpcAccessServiceSettings.newHttpJsonBuilder().build();
 VpcAccessServiceClient vpcAccessServiceClient =
     VpcAccessServiceClient.create(vpcAccessServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > VpcAccessServiceClient

Implements

BackgroundResource

Static Methods

create()

public static final VpcAccessServiceClient create()

Constructs an instance of VpcAccessServiceClient with default settings.

Returns
TypeDescription
VpcAccessServiceClient
Exceptions
TypeDescription
IOException

create(VpcAccessServiceSettings settings)

public static final VpcAccessServiceClient create(VpcAccessServiceSettings settings)

Constructs an instance of VpcAccessServiceClient, 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
settingsVpcAccessServiceSettings
Returns
TypeDescription
VpcAccessServiceClient
Exceptions
TypeDescription
IOException

create(VpcAccessServiceStub stub)

public static final VpcAccessServiceClient create(VpcAccessServiceStub stub)

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

Parameter
NameDescription
stubVpcAccessServiceStub
Returns
TypeDescription
VpcAccessServiceClient

Constructors

VpcAccessServiceClient(VpcAccessServiceSettings settings)

protected VpcAccessServiceClient(VpcAccessServiceSettings settings)

Constructs an instance of VpcAccessServiceClient, 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
settingsVpcAccessServiceSettings

VpcAccessServiceClient(VpcAccessServiceStub stub)

protected VpcAccessServiceClient(VpcAccessServiceStub stub)
Parameter
NameDescription
stubVpcAccessServiceStub

Methods

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

createConnectorAsync(CreateConnectorRequest request)

public final OperationFuture<Connector,OperationMetadata> createConnectorAsync(CreateConnectorRequest request)

Creates a Serverless VPC Access connector, returns an operation.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   CreateConnectorRequest request =
       CreateConnectorRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setConnectorId("connectorId1724784200")
           .setConnector(Connector.newBuilder().build())
           .build();
   Connector response = vpcAccessServiceClient.createConnectorAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateConnectorRequest

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

Returns
TypeDescription
OperationFuture<Connector,OperationMetadata>

createConnectorAsync(LocationName parent, String connectorId, Connector connector)

public final OperationFuture<Connector,OperationMetadata> createConnectorAsync(LocationName parent, String connectorId, Connector connector)

Creates a Serverless VPC Access connector, returns an operation.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   String connectorId = "connectorId1724784200";
   Connector connector = Connector.newBuilder().build();
   Connector response =
       vpcAccessServiceClient.createConnectorAsync(parent, connectorId, connector).get();
 }
 
Parameters
NameDescription
parentLocationName

Required. The project and location in which the configuration should be created, specified in the format projects/*/locations/*.

connectorIdString

Required. The ID to use for this connector.

connectorConnector

Required. Resource to create.

Returns
TypeDescription
OperationFuture<Connector,OperationMetadata>

createConnectorAsync(String parent, String connectorId, Connector connector)

public final OperationFuture<Connector,OperationMetadata> createConnectorAsync(String parent, String connectorId, Connector connector)

Creates a Serverless VPC Access connector, returns an operation.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   String connectorId = "connectorId1724784200";
   Connector connector = Connector.newBuilder().build();
   Connector response =
       vpcAccessServiceClient.createConnectorAsync(parent, connectorId, connector).get();
 }
 
Parameters
NameDescription
parentString

Required. The project and location in which the configuration should be created, specified in the format projects/*/locations/*.

connectorIdString

Required. The ID to use for this connector.

connectorConnector

Required. Resource to create.

Returns
TypeDescription
OperationFuture<Connector,OperationMetadata>

createConnectorCallable()

public final UnaryCallable<CreateConnectorRequest,Operation> createConnectorCallable()

Creates a Serverless VPC Access connector, returns an operation.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   CreateConnectorRequest request =
       CreateConnectorRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setConnectorId("connectorId1724784200")
           .setConnector(Connector.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       vpcAccessServiceClient.createConnectorCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateConnectorRequest,Operation>

createConnectorOperationCallable()

public final OperationCallable<CreateConnectorRequest,Connector,OperationMetadata> createConnectorOperationCallable()

Creates a Serverless VPC Access connector, returns an operation.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   CreateConnectorRequest request =
       CreateConnectorRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setConnectorId("connectorId1724784200")
           .setConnector(Connector.newBuilder().build())
           .build();
   OperationFuture<Connector, OperationMetadata> future =
       vpcAccessServiceClient.createConnectorOperationCallable().futureCall(request);
   // Do something.
   Connector response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CreateConnectorRequest,Connector,OperationMetadata>

deleteConnectorAsync(ConnectorName name)

public final OperationFuture<Empty,OperationMetadata> deleteConnectorAsync(ConnectorName name)

Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   ConnectorName name = ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECTOR]");
   vpcAccessServiceClient.deleteConnectorAsync(name).get();
 }
 
Parameter
NameDescription
nameConnectorName

Required. Name of a Serverless VPC Access connector to delete.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteConnectorAsync(DeleteConnectorRequest request)

public final OperationFuture<Empty,OperationMetadata> deleteConnectorAsync(DeleteConnectorRequest request)

Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   DeleteConnectorRequest request =
       DeleteConnectorRequest.newBuilder()
           .setName(ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECTOR]").toString())
           .build();
   vpcAccessServiceClient.deleteConnectorAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteConnectorRequest

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

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteConnectorAsync(String name)

public final OperationFuture<Empty,OperationMetadata> deleteConnectorAsync(String name)

Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   String name = ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECTOR]").toString();
   vpcAccessServiceClient.deleteConnectorAsync(name).get();
 }
 
Parameter
NameDescription
nameString

Required. Name of a Serverless VPC Access connector to delete.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteConnectorCallable()

public final UnaryCallable<DeleteConnectorRequest,Operation> deleteConnectorCallable()

Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   DeleteConnectorRequest request =
       DeleteConnectorRequest.newBuilder()
           .setName(ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECTOR]").toString())
           .build();
   ApiFuture<Operation> future =
       vpcAccessServiceClient.deleteConnectorCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteConnectorRequest,Operation>

deleteConnectorOperationCallable()

public final OperationCallable<DeleteConnectorRequest,Empty,OperationMetadata> deleteConnectorOperationCallable()

Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   DeleteConnectorRequest request =
       DeleteConnectorRequest.newBuilder()
           .setName(ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECTOR]").toString())
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       vpcAccessServiceClient.deleteConnectorOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteConnectorRequest,Empty,OperationMetadata>

getConnector(ConnectorName name)

public final Connector getConnector(ConnectorName name)

Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   ConnectorName name = ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECTOR]");
   Connector response = vpcAccessServiceClient.getConnector(name);
 }
 
Parameter
NameDescription
nameConnectorName

Required. Name of a Serverless VPC Access connector to get.

Returns
TypeDescription
Connector

getConnector(GetConnectorRequest request)

public final Connector getConnector(GetConnectorRequest request)

Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   GetConnectorRequest request =
       GetConnectorRequest.newBuilder()
           .setName(ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECTOR]").toString())
           .build();
   Connector response = vpcAccessServiceClient.getConnector(request);
 }
 
Parameter
NameDescription
requestGetConnectorRequest

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

Returns
TypeDescription
Connector

getConnector(String name)

public final Connector getConnector(String name)

Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   String name = ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECTOR]").toString();
   Connector response = vpcAccessServiceClient.getConnector(name);
 }
 
Parameter
NameDescription
nameString

Required. Name of a Serverless VPC Access connector to get.

Returns
TypeDescription
Connector

getConnectorCallable()

public final UnaryCallable<GetConnectorRequest,Connector> getConnectorCallable()

Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   GetConnectorRequest request =
       GetConnectorRequest.newBuilder()
           .setName(ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECTOR]").toString())
           .build();
   ApiFuture<Connector> future =
       vpcAccessServiceClient.getConnectorCallable().futureCall(request);
   // Do something.
   Connector response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetConnectorRequest,Connector>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getSettings()

public final VpcAccessServiceSettings getSettings()
Returns
TypeDescription
VpcAccessServiceSettings

getStub()

public VpcAccessServiceStub getStub()
Returns
TypeDescription
VpcAccessServiceStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listConnectors(ListConnectorsRequest request)

public final VpcAccessServiceClient.ListConnectorsPagedResponse listConnectors(ListConnectorsRequest request)

Lists Serverless VPC Access connectors.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   ListConnectorsRequest request =
       ListConnectorsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Connector element : vpcAccessServiceClient.listConnectors(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListConnectorsRequest

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

Returns
TypeDescription
VpcAccessServiceClient.ListConnectorsPagedResponse

listConnectors(LocationName parent)

public final VpcAccessServiceClient.ListConnectorsPagedResponse listConnectors(LocationName parent)

Lists Serverless VPC Access connectors.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (Connector element : vpcAccessServiceClient.listConnectors(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentLocationName

Required. The project and location from which the routes should be listed.

Returns
TypeDescription
VpcAccessServiceClient.ListConnectorsPagedResponse

listConnectors(String parent)

public final VpcAccessServiceClient.ListConnectorsPagedResponse listConnectors(String parent)

Lists Serverless VPC Access connectors.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (Connector element : vpcAccessServiceClient.listConnectors(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The project and location from which the routes should be listed.

Returns
TypeDescription
VpcAccessServiceClient.ListConnectorsPagedResponse

listConnectorsCallable()

public final UnaryCallable<ListConnectorsRequest,ListConnectorsResponse> listConnectorsCallable()

Lists Serverless VPC Access connectors.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   ListConnectorsRequest request =
       ListConnectorsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListConnectorsResponse response =
         vpcAccessServiceClient.listConnectorsCallable().call(request);
     for (Connector element : response.getConnectorsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListConnectorsRequest,ListConnectorsResponse>

listConnectorsPagedCallable()

public final UnaryCallable<ListConnectorsRequest,VpcAccessServiceClient.ListConnectorsPagedResponse> listConnectorsPagedCallable()

Lists Serverless VPC Access connectors.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   ListConnectorsRequest request =
       ListConnectorsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Connector> future =
       vpcAccessServiceClient.listConnectorsPagedCallable().futureCall(request);
   // Do something.
   for (Connector element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListConnectorsRequest,ListConnectorsPagedResponse>

listLocations(ListLocationsRequest request)

public final VpcAccessServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

Lists information about the supported locations for this service.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Location element : vpcAccessServiceClient.listLocations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.ListLocationsRequest

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

Returns
TypeDescription
VpcAccessServiceClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()

Lists information about the supported locations for this service.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListLocationsResponse response =
         vpcAccessServiceClient.listLocationsCallable().call(request);
     for (Location element : response.getLocationsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,VpcAccessServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()

Lists information about the supported locations for this service.

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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Location> future =
       vpcAccessServiceClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()