Class ProjectViewsClient (1.109.0)

GitHub RepositoryProduct Reference

Service Description: The ProjectViews API.

This client uses ProjectViews 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 (ProjectViewsClient projectViewsClient = ProjectViewsClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   ProjectView response = projectViewsClient.get(project, region);
 }
 

Note: close() needs to be called on the ProjectViewsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

Get

Returns the specified global ProjectViews resource, with a regional context. This regional API endpoint reads resource metadata from regional read-only replicas. Because changes are copied to these regional replicas asynchronously, for real-time resource reads or any write operations (creating, updating, or deleting resources), use the global projects.get endpoint.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • get(GetProjectViewRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • get(String project, String region)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getCallable()

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 ProjectViewsSettings 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
 ProjectViewsSettings projectViewsSettings =
     ProjectViewsSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ProjectViewsClient projectViewsClient = ProjectViewsClient.create(projectViewsSettings);
 

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
 ProjectViewsSettings projectViewsSettings =
     ProjectViewsSettings.newBuilder().setEndpoint(myEndpoint).build();
 ProjectViewsClient projectViewsClient = ProjectViewsClient.create(projectViewsSettings);
 

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

Inheritance

java.lang.Object > ProjectViewsClient

Static Methods

create()

public static final ProjectViewsClient create()

Constructs an instance of ProjectViewsClient with default settings.

Returns
Type Description
ProjectViewsClient
Exceptions
Type Description
IOException

create(ProjectViewsSettings settings)

public static final ProjectViewsClient create(ProjectViewsSettings settings)

Constructs an instance of ProjectViewsClient, 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 ProjectViewsSettings
Returns
Type Description
ProjectViewsClient
Exceptions
Type Description
IOException

create(ProjectViewsStub stub)

public static final ProjectViewsClient create(ProjectViewsStub stub)

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

Parameter
Name Description
stub ProjectViewsStub
Returns
Type Description
ProjectViewsClient

Constructors

ProjectViewsClient(ProjectViewsSettings settings)

protected ProjectViewsClient(ProjectViewsSettings settings)

Constructs an instance of ProjectViewsClient, 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 ProjectViewsSettings

ProjectViewsClient(ProjectViewsStub stub)

protected ProjectViewsClient(ProjectViewsStub stub)
Parameter
Name Description
stub ProjectViewsStub

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

public final ProjectView get(GetProjectViewRequest request)

Returns the specified global ProjectViews resource, with a regional context. This regional API endpoint reads resource metadata from regional read-only replicas. Because changes are copied to these regional replicas asynchronously, for real-time resource reads or any write operations (creating, updating, or deleting resources), use the global projects.get endpoint.

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 (ProjectViewsClient projectViewsClient = ProjectViewsClient.create()) {
   GetProjectViewRequest request =
       GetProjectViewRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .build();
   ProjectView response = projectViewsClient.get(request);
 }
 
Parameter
Name Description
request GetProjectViewRequest

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

Returns
Type Description
ProjectView

get(String project, String region)

public final ProjectView get(String project, String region)

Returns the specified global ProjectViews resource, with a regional context. This regional API endpoint reads resource metadata from regional read-only replicas. Because changes are copied to these regional replicas asynchronously, for real-time resource reads or any write operations (creating, updating, or deleting resources), use the global projects.get endpoint.

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 (ProjectViewsClient projectViewsClient = ProjectViewsClient.create()) {
   String project = "project-309310695";
   String region = "region-934795532";
   ProjectView response = projectViewsClient.get(project, region);
 }
 
Parameters
Name Description
project String

Required. Project ID for this request. This is part of the URL path.

region String

Required. Name of the region for this request. This is part of the URL path.

Returns
Type Description
ProjectView

getCallable()

public final UnaryCallable<GetProjectViewRequest,ProjectView> getCallable()

Returns the specified global ProjectViews resource, with a regional context. This regional API endpoint reads resource metadata from regional read-only replicas. Because changes are copied to these regional replicas asynchronously, for real-time resource reads or any write operations (creating, updating, or deleting resources), use the global projects.get endpoint.

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 (ProjectViewsClient projectViewsClient = ProjectViewsClient.create()) {
   GetProjectViewRequest request =
       GetProjectViewRequest.newBuilder()
           .setProject("project-309310695")
           .setRegion("region-934795532")
           .build();
   ApiFuture<ProjectView> future = projectViewsClient.getCallable().futureCall(request);
   // Do something.
   ProjectView response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetProjectViewRequest,ProjectView>

getSettings()

public final @Nullable ProjectViewsSettings getSettings()
Returns
Type Description
@org.jspecify.annotations.Nullable com.google.cloud.compute.v1.ProjectViewsSettings

getStub()

public ProjectViewsStub getStub()
Returns
Type Description
ProjectViewsStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()