@Generated(value="by gapic-generator-java") public class VersionsClient extends Object implements 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 (VersionsClient versionsClient = VersionsClient.create()) {
VersionName name = VersionName.ofProjectVersionName("[PROJECT]", "[VERSION]");
Version response = versionsClient.getVersion(name);
}
Note: close() needs to be called on the VersionsClient 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:
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 VersionsSettings 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
VersionsSettings versionsSettings =
VersionsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
VersionsClient versionsClient = VersionsClient.create(versionsSettings);
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
VersionsSettings versionsSettings =
VersionsSettings.newBuilder().setEndpoint(myEndpoint).build();
VersionsClient versionsClient = VersionsClient.create(versionsSettings);
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
VersionsSettings versionsSettings =
VersionsSettings.newBuilder()
.setTransportChannelProvider(
VersionsSettings.defaultHttpJsonTransportProviderBuilder().build())
.build();
VersionsClient versionsClient = VersionsClient.create(versionsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Modifier and Type | Class and Description |
---|---|
static class |
VersionsClient.ListLocationsFixedSizeCollection |
static class |
VersionsClient.ListLocationsPage |
static class |
VersionsClient.ListLocationsPagedResponse |
static class |
VersionsClient.ListVersionsFixedSizeCollection |
static class |
VersionsClient.ListVersionsPage |
static class |
VersionsClient.ListVersionsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
VersionsClient(VersionsSettings settings)
Constructs an instance of VersionsClient, using the given settings.
|
protected |
VersionsClient(VersionsStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static VersionsClient |
create()
Constructs an instance of VersionsClient with default settings.
|
static VersionsClient |
create(VersionsSettings settings)
Constructs an instance of VersionsClient, using the given settings.
|
static VersionsClient |
create(VersionsStub stub)
Constructs an instance of VersionsClient, using the given stub for making calls.
|
Version |
createVersion(AgentName parent,
Version version)
Creates an agent version.
|
Version |
createVersion(CreateVersionRequest request)
Creates an agent version.
|
Version |
createVersion(String parent,
Version version)
Creates an agent version.
|
UnaryCallable<CreateVersionRequest,Version> |
createVersionCallable()
Creates an agent version.
|
void |
deleteVersion(DeleteVersionRequest request)
Delete the specified agent version.
|
void |
deleteVersion(String name)
Delete the specified agent version.
|
void |
deleteVersion(VersionName name)
Delete the specified agent version.
|
UnaryCallable<DeleteVersionRequest,Empty> |
deleteVersionCallable()
Delete the specified agent version.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
VersionsSettings |
getSettings() |
VersionsStub |
getStub() |
Version |
getVersion(GetVersionRequest request)
Retrieves the specified agent version.
|
Version |
getVersion(String name)
Retrieves the specified agent version.
|
Version |
getVersion(VersionName name)
Retrieves the specified agent version.
|
UnaryCallable<GetVersionRequest,Version> |
getVersionCallable()
Retrieves the specified agent version.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
VersionsClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
UnaryCallable<com.google.cloud.location.ListLocationsRequest,VersionsClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
VersionsClient.ListVersionsPagedResponse |
listVersions(AgentName parent)
Returns the list of all versions of the specified agent.
|
VersionsClient.ListVersionsPagedResponse |
listVersions(ListVersionsRequest request)
Returns the list of all versions of the specified agent.
|
VersionsClient.ListVersionsPagedResponse |
listVersions(String parent)
Returns the list of all versions of the specified agent.
|
UnaryCallable<ListVersionsRequest,ListVersionsResponse> |
listVersionsCallable()
Returns the list of all versions of the specified agent.
|
UnaryCallable<ListVersionsRequest,VersionsClient.ListVersionsPagedResponse> |
listVersionsPagedCallable()
Returns the list of all versions of the specified agent.
|
void |
shutdown() |
void |
shutdownNow() |
Version |
updateVersion(UpdateVersionRequest request)
Updates the specified agent version.
|
Version |
updateVersion(Version version,
FieldMask updateMask)
Updates the specified agent version.
|
UnaryCallable<UpdateVersionRequest,Version> |
updateVersionCallable()
Updates the specified agent version.
|
protected VersionsClient(VersionsSettings settings) throws IOException
IOException
protected VersionsClient(VersionsStub stub)
public static final VersionsClient create() throws IOException
IOException
public static final VersionsClient create(VersionsSettings settings) throws IOException
IOException
public static final VersionsClient create(VersionsStub stub)
public final VersionsSettings getSettings()
public VersionsStub getStub()
public final VersionsClient.ListVersionsPagedResponse listVersions(AgentName 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 (VersionsClient versionsClient = VersionsClient.create()) {
AgentName parent = AgentName.ofProjectName("[PROJECT]");
for (Version element : versionsClient.listVersions(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The agent to list all versions from. Supported formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
ApiException
- if the remote call failspublic final VersionsClient.ListVersionsPagedResponse listVersions(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 (VersionsClient versionsClient = VersionsClient.create()) {
String parent = AgentName.ofProjectName("[PROJECT]").toString();
for (Version element : versionsClient.listVersions(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The agent to list all versions from. Supported formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
ApiException
- if the remote call failspublic final VersionsClient.ListVersionsPagedResponse listVersions(ListVersionsRequest 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 (VersionsClient versionsClient = VersionsClient.create()) {
ListVersionsRequest request =
ListVersionsRequest.newBuilder()
.setParent(AgentName.ofProjectName("[PROJECT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Version element : versionsClient.listVersions(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<ListVersionsRequest,VersionsClient.ListVersionsPagedResponse> listVersionsPagedCallable()
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 (VersionsClient versionsClient = VersionsClient.create()) {
ListVersionsRequest request =
ListVersionsRequest.newBuilder()
.setParent(AgentName.ofProjectName("[PROJECT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Version> future = versionsClient.listVersionsPagedCallable().futureCall(request);
// Do something.
for (Version element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListVersionsRequest,ListVersionsResponse> listVersionsCallable()
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 (VersionsClient versionsClient = VersionsClient.create()) {
ListVersionsRequest request =
ListVersionsRequest.newBuilder()
.setParent(AgentName.ofProjectName("[PROJECT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListVersionsResponse response = versionsClient.listVersionsCallable().call(request);
for (Version element : response.getVersionsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Version getVersion(VersionName 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 (VersionsClient versionsClient = VersionsClient.create()) {
VersionName name = VersionName.ofProjectVersionName("[PROJECT]", "[VERSION]");
Version response = versionsClient.getVersion(name);
}
name
- Required. The name of the version. Supported formats:
- `projects/<Project ID>/agent/versions/<Version ID>` - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version ID>`
ApiException
- if the remote call failspublic final Version getVersion(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 (VersionsClient versionsClient = VersionsClient.create()) {
String name = VersionName.ofProjectVersionName("[PROJECT]", "[VERSION]").toString();
Version response = versionsClient.getVersion(name);
}
name
- Required. The name of the version. Supported formats:
- `projects/<Project ID>/agent/versions/<Version ID>` - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version ID>`
ApiException
- if the remote call failspublic final Version getVersion(GetVersionRequest 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 (VersionsClient versionsClient = VersionsClient.create()) {
GetVersionRequest request =
GetVersionRequest.newBuilder()
.setName(VersionName.ofProjectVersionName("[PROJECT]", "[VERSION]").toString())
.build();
Version response = versionsClient.getVersion(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<GetVersionRequest,Version> getVersionCallable()
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 (VersionsClient versionsClient = VersionsClient.create()) {
GetVersionRequest request =
GetVersionRequest.newBuilder()
.setName(VersionName.ofProjectVersionName("[PROJECT]", "[VERSION]").toString())
.build();
ApiFuture<Version> future = versionsClient.getVersionCallable().futureCall(request);
// Do something.
Version response = future.get();
}
public final Version createVersion(AgentName parent, Version version)
The new version points to the agent instance in the "default" environment.
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 (VersionsClient versionsClient = VersionsClient.create()) {
AgentName parent = AgentName.ofProjectName("[PROJECT]");
Version version = Version.newBuilder().build();
Version response = versionsClient.createVersion(parent, version);
}
parent
- Required. The agent to create a version for. Supported formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
version
- Required. The version to create.ApiException
- if the remote call failspublic final Version createVersion(String parent, Version version)
The new version points to the agent instance in the "default" environment.
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 (VersionsClient versionsClient = VersionsClient.create()) {
String parent = AgentName.ofProjectName("[PROJECT]").toString();
Version version = Version.newBuilder().build();
Version response = versionsClient.createVersion(parent, version);
}
parent
- Required. The agent to create a version for. Supported formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
version
- Required. The version to create.ApiException
- if the remote call failspublic final Version createVersion(CreateVersionRequest request)
The new version points to the agent instance in the "default" environment.
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 (VersionsClient versionsClient = VersionsClient.create()) {
CreateVersionRequest request =
CreateVersionRequest.newBuilder()
.setParent(AgentName.ofProjectName("[PROJECT]").toString())
.setVersion(Version.newBuilder().build())
.build();
Version response = versionsClient.createVersion(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<CreateVersionRequest,Version> createVersionCallable()
The new version points to the agent instance in the "default" environment.
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 (VersionsClient versionsClient = VersionsClient.create()) {
CreateVersionRequest request =
CreateVersionRequest.newBuilder()
.setParent(AgentName.ofProjectName("[PROJECT]").toString())
.setVersion(Version.newBuilder().build())
.build();
ApiFuture<Version> future = versionsClient.createVersionCallable().futureCall(request);
// Do something.
Version response = future.get();
}
public final Version updateVersion(Version version, FieldMask updateMask)
Note that this method does not allow you to update the state of the agent the given version points to. It allows you to update only mutable properties of the version 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 (VersionsClient versionsClient = VersionsClient.create()) {
Version version = Version.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Version response = versionsClient.updateVersion(version, updateMask);
}
version
- Required. The version to update. Supported formats:
- `projects/<Project ID>/agent/versions/<Version ID>` - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version ID>`
updateMask
- Required. The mask to control which fields get updated.ApiException
- if the remote call failspublic final Version updateVersion(UpdateVersionRequest request)
Note that this method does not allow you to update the state of the agent the given version points to. It allows you to update only mutable properties of the version 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 (VersionsClient versionsClient = VersionsClient.create()) {
UpdateVersionRequest request =
UpdateVersionRequest.newBuilder()
.setVersion(Version.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Version response = versionsClient.updateVersion(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<UpdateVersionRequest,Version> updateVersionCallable()
Note that this method does not allow you to update the state of the agent the given version points to. It allows you to update only mutable properties of the version 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 (VersionsClient versionsClient = VersionsClient.create()) {
UpdateVersionRequest request =
UpdateVersionRequest.newBuilder()
.setVersion(Version.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Version> future = versionsClient.updateVersionCallable().futureCall(request);
// Do something.
Version response = future.get();
}
public final void deleteVersion(VersionName 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 (VersionsClient versionsClient = VersionsClient.create()) {
VersionName name = VersionName.ofProjectVersionName("[PROJECT]", "[VERSION]");
versionsClient.deleteVersion(name);
}
name
- Required. The name of the version to delete. Supported formats:
- `projects/<Project ID>/agent/versions/<Version ID>` - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version ID>`
ApiException
- if the remote call failspublic final void deleteVersion(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 (VersionsClient versionsClient = VersionsClient.create()) {
String name = VersionName.ofProjectVersionName("[PROJECT]", "[VERSION]").toString();
versionsClient.deleteVersion(name);
}
name
- Required. The name of the version to delete. Supported formats:
- `projects/<Project ID>/agent/versions/<Version ID>` - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version ID>`
ApiException
- if the remote call failspublic final void deleteVersion(DeleteVersionRequest 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 (VersionsClient versionsClient = VersionsClient.create()) {
DeleteVersionRequest request =
DeleteVersionRequest.newBuilder()
.setName(VersionName.ofProjectVersionName("[PROJECT]", "[VERSION]").toString())
.build();
versionsClient.deleteVersion(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<DeleteVersionRequest,Empty> deleteVersionCallable()
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 (VersionsClient versionsClient = VersionsClient.create()) {
DeleteVersionRequest request =
DeleteVersionRequest.newBuilder()
.setName(VersionName.ofProjectVersionName("[PROJECT]", "[VERSION]").toString())
.build();
ApiFuture<Empty> future = versionsClient.deleteVersionCallable().futureCall(request);
// Do something.
future.get();
}
public final VersionsClient.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 (VersionsClient versionsClient = VersionsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : versionsClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.location.ListLocationsRequest,VersionsClient.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 (VersionsClient versionsClient = VersionsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future = versionsClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final 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 (VersionsClient versionsClient = VersionsClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response = versionsClient.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 com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest 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 (VersionsClient versionsClient = VersionsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = versionsClient.getLocation(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
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 (VersionsClient versionsClient = VersionsClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = versionsClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2022 Google LLC. All rights reserved.