| GitHub Repository | Product Reference |
Service Description: The ImageViews API.
This client uses ImageViews version 2026-09-01.
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 (ImageViewsClient imageViewsClient = ImageViewsClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String resourceId = "resourceId-1345650231";
ImageView response = imageViewsClient.get(project, region, resourceId);
}
Note: close() needs to be called on the ImageViewsClient 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 |
|---|---|---|
Get |
Returns the specified global ImageView resource, with a regional context. |
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.
|
List |
Returns a list of global ImageView resources, with a regional context. |
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.
|
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 ImageViewsSettings 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
ImageViewsSettings imageViewsSettings =
ImageViewsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ImageViewsClient imageViewsClient = ImageViewsClient.create(imageViewsSettings);
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
ImageViewsSettings imageViewsSettings =
ImageViewsSettings.newBuilder().setEndpoint(myEndpoint).build();
ImageViewsClient imageViewsClient = ImageViewsClient.create(imageViewsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final ImageViewsClient create()Constructs an instance of ImageViewsClient with default settings.
| Returns | |
|---|---|
| Type | Description |
ImageViewsClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(ImageViewsSettings settings)
public static final ImageViewsClient create(ImageViewsSettings settings)Constructs an instance of ImageViewsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
ImageViewsSettings |
| Returns | |
|---|---|
| Type | Description |
ImageViewsClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(ImageViewsStub stub)
public static final ImageViewsClient create(ImageViewsStub stub)Constructs an instance of ImageViewsClient, using the given stub for making calls. This is for advanced usage - prefer using create(ImageViewsSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
ImageViewsStub |
| Returns | |
|---|---|
| Type | Description |
ImageViewsClient |
|
Constructors
ImageViewsClient(ImageViewsSettings settings)
protected ImageViewsClient(ImageViewsSettings settings)Constructs an instance of ImageViewsClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
| Parameter | |
|---|---|
| Name | Description |
settings |
ImageViewsSettings |
ImageViewsClient(ImageViewsStub stub)
protected ImageViewsClient(ImageViewsStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
ImageViewsStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
public final void close()get(GetImageViewRequest request)
public final ImageView get(GetImageViewRequest request)Returns the specified global ImageView resource, with a regional context.
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 (ImageViewsClient imageViewsClient = ImageViewsClient.create()) {
GetImageViewRequest request =
GetImageViewRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setResourceId("resourceId-1345650231")
.build();
ImageView response = imageViewsClient.get(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetImageViewRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
ImageView |
|
get(String project, String region, String resourceId)
public final ImageView get(String project, String region, String resourceId)Returns the specified global ImageView resource, with a regional context.
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 (ImageViewsClient imageViewsClient = ImageViewsClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
String resourceId = "resourceId-1345650231";
ImageView response = imageViewsClient.get(project, region, resourceId);
}
| Parameters | |
|---|---|
| Name | Description |
project |
StringRequired. Project ID for this request. |
region |
StringRequired. Name of the region for this request. |
resourceId |
StringName of the image resource to return. |
| Returns | |
|---|---|
| Type | Description |
ImageView |
|
getCallable()
public final UnaryCallable<GetImageViewRequest,ImageView> getCallable()Returns the specified global ImageView resource, with a regional context.
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 (ImageViewsClient imageViewsClient = ImageViewsClient.create()) {
GetImageViewRequest request =
GetImageViewRequest.newBuilder()
.setProject("project-309310695")
.setRegion("region-934795532")
.setResourceId("resourceId-1345650231")
.build();
ApiFuture<ImageView> future = imageViewsClient.getCallable().futureCall(request);
// Do something.
ImageView response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetImageViewRequest,ImageView> |
|
getSettings()
public final @Nullable ImageViewsSettings getSettings()| Returns | |
|---|---|
| Type | Description |
@org.jspecify.annotations.Nullable com.google.cloud.compute.v1.ImageViewsSettings |
|
getStub()
public ImageViewsStub getStub()| Returns | |
|---|---|
| Type | Description |
ImageViewsStub |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
list(ListImageViewsRequest request)
public final ImageViewsClient.ListPagedResponse list(ListImageViewsRequest request)Returns a list of global ImageView resources, with a regional context.
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 (ImageViewsClient imageViewsClient = ImageViewsClient.create()) {
ListImageViewsRequest request =
ListImageViewsRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setRegion("region-934795532")
.build();
for (ImageView element : imageViewsClient.list(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListImageViewsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
ImageViewsClient.ListPagedResponse |
|
list(String project, String region)
public final ImageViewsClient.ListPagedResponse list(String project, String region)Returns a list of global ImageView resources, with a regional context.
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 (ImageViewsClient imageViewsClient = ImageViewsClient.create()) {
String project = "project-309310695";
String region = "region-934795532";
for (ImageView element : imageViewsClient.list(project, region).iterateAll()) {
// doThingsWith(element);
}
}
| Parameters | |
|---|---|
| Name | Description |
project |
StringRequired. Project ID for this request. |
region |
StringRequired. Name of the region for this request. |
| Returns | |
|---|---|
| Type | Description |
ImageViewsClient.ListPagedResponse |
|
listCallable()
public final UnaryCallable<ListImageViewsRequest,ImageViewsListResponse> listCallable()Returns a list of global ImageView resources, with a regional context.
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 (ImageViewsClient imageViewsClient = ImageViewsClient.create()) {
ListImageViewsRequest request =
ListImageViewsRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setRegion("region-934795532")
.build();
while (true) {
ImageViewsListResponse response = imageViewsClient.listCallable().call(request);
for (ImageView element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListImageViewsRequest,ImageViewsListResponse> |
|
listPagedCallable()
public final UnaryCallable<ListImageViewsRequest,ImageViewsClient.ListPagedResponse> listPagedCallable()Returns a list of global ImageView resources, with a regional context.
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 (ImageViewsClient imageViewsClient = ImageViewsClient.create()) {
ListImageViewsRequest request =
ListImageViewsRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setProject("project-309310695")
.setRegion("region-934795532")
.build();
ApiFuture<ImageView> future = imageViewsClient.listPagedCallable().futureCall(request);
// Do something.
for (ImageView element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListImageViewsRequest,ListPagedResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()