@Generated(value="by gapic-generator-java") public class VpcAccessServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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().
| Method | Description | Method Variants |
|---|---|---|
| CreateConnector | Creates a Serverless VPC Access connector, returns an operation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| GetConnector | Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| ListConnectors | Lists Serverless VPC Access connectors. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| DeleteConnector | Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| ListLocations | Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of 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.
| Modifier and Type | Class and Description |
|---|---|
static class |
VpcAccessServiceClient.ListConnectorsFixedSizeCollection |
static class |
VpcAccessServiceClient.ListConnectorsPage |
static class |
VpcAccessServiceClient.ListConnectorsPagedResponse |
static class |
VpcAccessServiceClient.ListLocationsFixedSizeCollection |
static class |
VpcAccessServiceClient.ListLocationsPage |
static class |
VpcAccessServiceClient.ListLocationsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
VpcAccessServiceClient(VpcAccessServiceSettings settings)
Constructs an instance of VpcAccessServiceClient, using the given settings.
|
protected |
VpcAccessServiceClient(VpcAccessServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static VpcAccessServiceClient |
create()
Constructs an instance of VpcAccessServiceClient with default settings.
|
static VpcAccessServiceClient |
create(VpcAccessServiceSettings settings)
Constructs an instance of VpcAccessServiceClient, using the given settings.
|
static VpcAccessServiceClient |
create(VpcAccessServiceStub stub)
Constructs an instance of VpcAccessServiceClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Connector,OperationMetadata> |
createConnectorAsync(CreateConnectorRequest request)
Creates a Serverless VPC Access connector, returns an operation.
|
com.google.api.gax.longrunning.OperationFuture<Connector,OperationMetadata> |
createConnectorAsync(LocationName parent,
String connectorId,
Connector connector)
Creates a Serverless VPC Access connector, returns an operation.
|
com.google.api.gax.longrunning.OperationFuture<Connector,OperationMetadata> |
createConnectorAsync(String parent,
String connectorId,
Connector connector)
Creates a Serverless VPC Access connector, returns an operation.
|
com.google.api.gax.rpc.UnaryCallable<CreateConnectorRequest,com.google.longrunning.Operation> |
createConnectorCallable()
Creates a Serverless VPC Access connector, returns an operation.
|
com.google.api.gax.rpc.OperationCallable<CreateConnectorRequest,Connector,OperationMetadata> |
createConnectorOperationCallable()
Creates a Serverless VPC Access connector, returns an operation.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteConnectorAsync(ConnectorName name)
Deletes a Serverless VPC Access connector.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteConnectorAsync(DeleteConnectorRequest request)
Deletes a Serverless VPC Access connector.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteConnectorAsync(String name)
Deletes a Serverless VPC Access connector.
|
com.google.api.gax.rpc.UnaryCallable<DeleteConnectorRequest,com.google.longrunning.Operation> |
deleteConnectorCallable()
Deletes a Serverless VPC Access connector.
|
com.google.api.gax.rpc.OperationCallable<DeleteConnectorRequest,com.google.protobuf.Empty,OperationMetadata> |
deleteConnectorOperationCallable()
Deletes a Serverless VPC Access connector.
|
Connector |
getConnector(ConnectorName name)
Gets a Serverless VPC Access connector.
|
Connector |
getConnector(GetConnectorRequest request)
Gets a Serverless VPC Access connector.
|
Connector |
getConnector(String name)
Gets a Serverless VPC Access connector.
|
com.google.api.gax.rpc.UnaryCallable<GetConnectorRequest,Connector> |
getConnectorCallable()
Gets a Serverless VPC Access connector.
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
VpcAccessServiceSettings |
getSettings() |
VpcAccessServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
VpcAccessServiceClient.ListConnectorsPagedResponse |
listConnectors(ListConnectorsRequest request)
Lists Serverless VPC Access connectors.
|
VpcAccessServiceClient.ListConnectorsPagedResponse |
listConnectors(LocationName parent)
Lists Serverless VPC Access connectors.
|
VpcAccessServiceClient.ListConnectorsPagedResponse |
listConnectors(String parent)
Lists Serverless VPC Access connectors.
|
com.google.api.gax.rpc.UnaryCallable<ListConnectorsRequest,ListConnectorsResponse> |
listConnectorsCallable()
Lists Serverless VPC Access connectors.
|
com.google.api.gax.rpc.UnaryCallable<ListConnectorsRequest,VpcAccessServiceClient.ListConnectorsPagedResponse> |
listConnectorsPagedCallable()
Lists Serverless VPC Access connectors.
|
VpcAccessServiceClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,VpcAccessServiceClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
void |
shutdown() |
void |
shutdownNow() |
protected VpcAccessServiceClient(VpcAccessServiceSettings settings) throws IOException
IOExceptionprotected VpcAccessServiceClient(VpcAccessServiceStub stub)
public static final VpcAccessServiceClient create() throws IOException
IOExceptionpublic static final VpcAccessServiceClient create(VpcAccessServiceSettings settings) throws IOException
IOExceptionpublic static final VpcAccessServiceClient create(VpcAccessServiceStub stub)
public final VpcAccessServiceSettings getSettings()
public VpcAccessServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final com.google.api.gax.longrunning.OperationFuture<Connector,OperationMetadata> createConnectorAsync(LocationName parent, String connectorId, Connector connector)
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();
}
parent - Required. The project and location in which the configuration should be created,
specified in the format `projects/*/locations/*`.connectorId - Required. The ID to use for this connector.connector - Required. Resource to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Connector,OperationMetadata> createConnectorAsync(String parent, String connectorId, Connector connector)
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();
}
parent - Required. The project and location in which the configuration should be created,
specified in the format `projects/*/locations/*`.connectorId - Required. The ID to use for this connector.connector - Required. Resource to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Connector,OperationMetadata> createConnectorAsync(CreateConnectorRequest 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 (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateConnectorRequest,Connector,OperationMetadata> createConnectorOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateConnectorRequest,com.google.longrunning.Operation> createConnectorCallable()
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();
}
public final Connector getConnector(ConnectorName name)
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);
}
name - Required. Name of a Serverless VPC Access connector to get.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Connector getConnector(String name)
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);
}
name - Required. Name of a Serverless VPC Access connector to get.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Connector getConnector(GetConnectorRequest 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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
GetConnectorRequest request =
GetConnectorRequest.newBuilder()
.setName(ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECTOR]").toString())
.build();
Connector response = vpcAccessServiceClient.getConnector(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetConnectorRequest,Connector> getConnectorCallable()
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();
}
public final VpcAccessServiceClient.ListConnectorsPagedResponse listConnectors(LocationName parent)
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);
}
}
parent - Required. The project and location from which the routes should be listed.com.google.api.gax.rpc.ApiException - if the remote call failspublic final VpcAccessServiceClient.ListConnectorsPagedResponse listConnectors(String parent)
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);
}
}
parent - Required. The project and location from which the routes should be listed.com.google.api.gax.rpc.ApiException - if the remote call failspublic final VpcAccessServiceClient.ListConnectorsPagedResponse listConnectors(ListConnectorsRequest 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 (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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListConnectorsRequest,VpcAccessServiceClient.ListConnectorsPagedResponse> listConnectorsPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListConnectorsRequest,ListConnectorsResponse> listConnectorsCallable()
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;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteConnectorAsync(ConnectorName name)
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();
}
name - Required. Name of a Serverless VPC Access connector to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteConnectorAsync(String name)
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();
}
name - Required. Name of a Serverless VPC Access connector to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteConnectorAsync(DeleteConnectorRequest 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 (VpcAccessServiceClient vpcAccessServiceClient = VpcAccessServiceClient.create()) {
DeleteConnectorRequest request =
DeleteConnectorRequest.newBuilder()
.setName(ConnectorName.of("[PROJECT]", "[LOCATION]", "[CONNECTOR]").toString())
.build();
vpcAccessServiceClient.deleteConnectorAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteConnectorRequest,com.google.protobuf.Empty,OperationMetadata> deleteConnectorOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteConnectorRequest,com.google.longrunning.Operation> deleteConnectorCallable()
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();
}
public final VpcAccessServiceClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest 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 (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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,VpcAccessServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
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;
}
}
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.