Class ProjectsClient (1.29.0)

public class ProjectsClient implements BackgroundResource

Service Description: The Projects API.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   Project response = projectsClient.get(project);
 }
 

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

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of ProjectsSettings 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
 ProjectsSettings projectsSettings =
     ProjectsSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ProjectsClient projectsClient = ProjectsClient.create(projectsSettings);
 

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
 ProjectsSettings projectsSettings =
     ProjectsSettings.newBuilder().setEndpoint(myEndpoint).build();
 ProjectsClient projectsClient = ProjectsClient.create(projectsSettings);
 

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

Inheritance

java.lang.Object > ProjectsClient

Implements

BackgroundResource

Static Methods

create()

public static final ProjectsClient create()

Constructs an instance of ProjectsClient with default settings.

Returns
TypeDescription
ProjectsClient
Exceptions
TypeDescription
IOException

create(ProjectsSettings settings)

public static final ProjectsClient create(ProjectsSettings settings)

Constructs an instance of ProjectsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsProjectsSettings
Returns
TypeDescription
ProjectsClient
Exceptions
TypeDescription
IOException

create(ProjectsStub stub)

public static final ProjectsClient create(ProjectsStub stub)

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

Parameter
NameDescription
stubProjectsStub
Returns
TypeDescription
ProjectsClient

Constructors

ProjectsClient(ProjectsSettings settings)

protected ProjectsClient(ProjectsSettings settings)

Constructs an instance of ProjectsClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsProjectsSettings

ProjectsClient(ProjectsStub stub)

protected ProjectsClient(ProjectsStub stub)
Parameter
NameDescription
stubProjectsStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

disableXpnHostAsync(DisableXpnHostProjectRequest request)

public final OperationFuture<Operation,Operation> disableXpnHostAsync(DisableXpnHostProjectRequest request)

Disable this project as a shared VPC host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   DisableXpnHostProjectRequest request =
       DisableXpnHostProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = projectsClient.disableXpnHostAsync(request).get();
 }
 
Parameter
NameDescription
requestDisableXpnHostProjectRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

disableXpnHostAsync(String project)

public final OperationFuture<Operation,Operation> disableXpnHostAsync(String project)

Disable this project as a shared VPC host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   Operation response = projectsClient.disableXpnHostAsync(project).get();
 }
 
Parameter
NameDescription
projectString

Project ID for this request.

Returns
TypeDescription
OperationFuture<Operation,Operation>

disableXpnHostCallable()

public final UnaryCallable<DisableXpnHostProjectRequest,Operation> disableXpnHostCallable()

Disable this project as a shared VPC host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   DisableXpnHostProjectRequest request =
       DisableXpnHostProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = projectsClient.disableXpnHostCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DisableXpnHostProjectRequest,Operation>

disableXpnHostOperationCallable()

public final OperationCallable<DisableXpnHostProjectRequest,Operation,Operation> disableXpnHostOperationCallable()

Disable this project as a shared VPC host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   DisableXpnHostProjectRequest request =
       DisableXpnHostProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       projectsClient.disableXpnHostOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<DisableXpnHostProjectRequest,Operation,Operation>

disableXpnResourceAsync(DisableXpnResourceProjectRequest request)

public final OperationFuture<Operation,Operation> disableXpnResourceAsync(DisableXpnResourceProjectRequest request)

Disable a service resource (also known as service project) associated with this host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   DisableXpnResourceProjectRequest request =
       DisableXpnResourceProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setProjectsDisableXpnResourceRequestResource(
               ProjectsDisableXpnResourceRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Operation response = projectsClient.disableXpnResourceAsync(request).get();
 }
 
Parameter
NameDescription
requestDisableXpnResourceProjectRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

disableXpnResourceAsync(String project, ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource)

public final OperationFuture<Operation,Operation> disableXpnResourceAsync(String project, ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource)

Disable a service resource (also known as service project) associated with this host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource =
       ProjectsDisableXpnResourceRequest.newBuilder().build();
   Operation response =
       projectsClient
           .disableXpnResourceAsync(project, projectsDisableXpnResourceRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

projectsDisableXpnResourceRequestResourceProjectsDisableXpnResourceRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

disableXpnResourceCallable()

public final UnaryCallable<DisableXpnResourceProjectRequest,Operation> disableXpnResourceCallable()

Disable a service resource (also known as service project) associated with this host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   DisableXpnResourceProjectRequest request =
       DisableXpnResourceProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setProjectsDisableXpnResourceRequestResource(
               ProjectsDisableXpnResourceRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = projectsClient.disableXpnResourceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DisableXpnResourceProjectRequest,Operation>

disableXpnResourceOperationCallable()

public final OperationCallable<DisableXpnResourceProjectRequest,Operation,Operation> disableXpnResourceOperationCallable()

Disable a service resource (also known as service project) associated with this host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   DisableXpnResourceProjectRequest request =
       DisableXpnResourceProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setProjectsDisableXpnResourceRequestResource(
               ProjectsDisableXpnResourceRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       projectsClient.disableXpnResourceOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<DisableXpnResourceProjectRequest,Operation,Operation>

enableXpnHostAsync(EnableXpnHostProjectRequest request)

public final OperationFuture<Operation,Operation> enableXpnHostAsync(EnableXpnHostProjectRequest request)

Enable this project as a shared VPC host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   EnableXpnHostProjectRequest request =
       EnableXpnHostProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = projectsClient.enableXpnHostAsync(request).get();
 }
 
Parameter
NameDescription
requestEnableXpnHostProjectRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

enableXpnHostAsync(String project)

public final OperationFuture<Operation,Operation> enableXpnHostAsync(String project)

Enable this project as a shared VPC host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   Operation response = projectsClient.enableXpnHostAsync(project).get();
 }
 
Parameter
NameDescription
projectString

Project ID for this request.

Returns
TypeDescription
OperationFuture<Operation,Operation>

enableXpnHostCallable()

public final UnaryCallable<EnableXpnHostProjectRequest,Operation> enableXpnHostCallable()

Enable this project as a shared VPC host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   EnableXpnHostProjectRequest request =
       EnableXpnHostProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = projectsClient.enableXpnHostCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<EnableXpnHostProjectRequest,Operation>

enableXpnHostOperationCallable()

public final OperationCallable<EnableXpnHostProjectRequest,Operation,Operation> enableXpnHostOperationCallable()

Enable this project as a shared VPC host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   EnableXpnHostProjectRequest request =
       EnableXpnHostProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       projectsClient.enableXpnHostOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<EnableXpnHostProjectRequest,Operation,Operation>

enableXpnResourceAsync(EnableXpnResourceProjectRequest request)

public final OperationFuture<Operation,Operation> enableXpnResourceAsync(EnableXpnResourceProjectRequest request)

Enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   EnableXpnResourceProjectRequest request =
       EnableXpnResourceProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setProjectsEnableXpnResourceRequestResource(
               ProjectsEnableXpnResourceRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Operation response = projectsClient.enableXpnResourceAsync(request).get();
 }
 
Parameter
NameDescription
requestEnableXpnResourceProjectRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

enableXpnResourceAsync(String project, ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource)

public final OperationFuture<Operation,Operation> enableXpnResourceAsync(String project, ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource)

Enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource =
       ProjectsEnableXpnResourceRequest.newBuilder().build();
   Operation response =
       projectsClient
           .enableXpnResourceAsync(project, projectsEnableXpnResourceRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

projectsEnableXpnResourceRequestResourceProjectsEnableXpnResourceRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

enableXpnResourceCallable()

public final UnaryCallable<EnableXpnResourceProjectRequest,Operation> enableXpnResourceCallable()

Enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   EnableXpnResourceProjectRequest request =
       EnableXpnResourceProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setProjectsEnableXpnResourceRequestResource(
               ProjectsEnableXpnResourceRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = projectsClient.enableXpnResourceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<EnableXpnResourceProjectRequest,Operation>

enableXpnResourceOperationCallable()

public final OperationCallable<EnableXpnResourceProjectRequest,Operation,Operation> enableXpnResourceOperationCallable()

Enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   EnableXpnResourceProjectRequest request =
       EnableXpnResourceProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setProjectsEnableXpnResourceRequestResource(
               ProjectsEnableXpnResourceRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       projectsClient.enableXpnResourceOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<EnableXpnResourceProjectRequest,Operation,Operation>

get(GetProjectRequest request)

public final Project get(GetProjectRequest request)

Returns the specified Project resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas field). To exclude one or more fields, set your request's fields query parameter to only include the fields you need. For example, to only include the id and selfLink fields, add the query parameter ?fields=id,selfLink to your 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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   GetProjectRequest request =
       GetProjectRequest.newBuilder().setProject("project-309310695").build();
   Project response = projectsClient.get(request);
 }
 
Parameter
NameDescription
requestGetProjectRequest

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

Returns
TypeDescription
Project

get(String project)

public final Project get(String project)

Returns the specified Project resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas field). To exclude one or more fields, set your request's fields query parameter to only include the fields you need. For example, to only include the id and selfLink fields, add the query parameter ?fields=id,selfLink to your 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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   Project response = projectsClient.get(project);
 }
 
Parameter
NameDescription
projectString

Project ID for this request.

Returns
TypeDescription
Project

getCallable()

public final UnaryCallable<GetProjectRequest,Project> getCallable()

Returns the specified Project resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas field). To exclude one or more fields, set your request's fields query parameter to only include the fields you need. For example, to only include the id and selfLink fields, add the query parameter ?fields=id,selfLink to your 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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   GetProjectRequest request =
       GetProjectRequest.newBuilder().setProject("project-309310695").build();
   ApiFuture<Project> future = projectsClient.getCallable().futureCall(request);
   // Do something.
   Project response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetProjectRequest,Project>

getSettings()

public final ProjectsSettings getSettings()
Returns
TypeDescription
ProjectsSettings

getStub()

public ProjectsStub getStub()
Returns
TypeDescription
ProjectsStub

getXpnHost(GetXpnHostProjectRequest request)

public final Project getXpnHost(GetXpnHostProjectRequest request)

Gets the shared VPC host project that this project links to. May be empty if no link exists.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   GetXpnHostProjectRequest request =
       GetXpnHostProjectRequest.newBuilder().setProject("project-309310695").build();
   Project response = projectsClient.getXpnHost(request);
 }
 
Parameter
NameDescription
requestGetXpnHostProjectRequest

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

Returns
TypeDescription
Project

getXpnHost(String project)

public final Project getXpnHost(String project)

Gets the shared VPC host project that this project links to. May be empty if no link exists.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   Project response = projectsClient.getXpnHost(project);
 }
 
Parameter
NameDescription
projectString

Project ID for this request.

Returns
TypeDescription
Project

getXpnHostCallable()

public final UnaryCallable<GetXpnHostProjectRequest,Project> getXpnHostCallable()

Gets the shared VPC host project that this project links to. May be empty if no link exists.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   GetXpnHostProjectRequest request =
       GetXpnHostProjectRequest.newBuilder().setProject("project-309310695").build();
   ApiFuture<Project> future = projectsClient.getXpnHostCallable().futureCall(request);
   // Do something.
   Project response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetXpnHostProjectRequest,Project>

getXpnResources(GetXpnResourcesProjectsRequest request)

public final ProjectsClient.GetXpnResourcesPagedResponse getXpnResources(GetXpnResourcesProjectsRequest request)

Gets service resources (a.k.a service project) associated with this host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   GetXpnResourcesProjectsRequest request =
       GetXpnResourcesProjectsRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   for (XpnResourceId element : projectsClient.getXpnResources(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestGetXpnResourcesProjectsRequest

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

Returns
TypeDescription
ProjectsClient.GetXpnResourcesPagedResponse

getXpnResources(String project)

public final ProjectsClient.GetXpnResourcesPagedResponse getXpnResources(String project)

Gets service resources (a.k.a service project) associated with this host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   for (XpnResourceId element : projectsClient.getXpnResources(project).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
projectString

Project ID for this request.

Returns
TypeDescription
ProjectsClient.GetXpnResourcesPagedResponse

getXpnResourcesCallable()

public final UnaryCallable<GetXpnResourcesProjectsRequest,ProjectsGetXpnResources> getXpnResourcesCallable()

Gets service resources (a.k.a service project) associated with this host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   GetXpnResourcesProjectsRequest request =
       GetXpnResourcesProjectsRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   while (true) {
     ProjectsGetXpnResources response = projectsClient.getXpnResourcesCallable().call(request);
     for (XpnResourceId element : response.getResourcesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<GetXpnResourcesProjectsRequest,ProjectsGetXpnResources>

getXpnResourcesPagedCallable()

public final UnaryCallable<GetXpnResourcesProjectsRequest,ProjectsClient.GetXpnResourcesPagedResponse> getXpnResourcesPagedCallable()

Gets service resources (a.k.a service project) associated with this host project.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   GetXpnResourcesProjectsRequest request =
       GetXpnResourcesProjectsRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   ApiFuture<XpnResourceId> future =
       projectsClient.getXpnResourcesPagedCallable().futureCall(request);
   // Do something.
   for (XpnResourceId element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<GetXpnResourcesProjectsRequest,GetXpnResourcesPagedResponse>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listXpnHosts(ListXpnHostsProjectsRequest request)

public final ProjectsClient.ListXpnHostsPagedResponse listXpnHosts(ListXpnHostsProjectsRequest request)

Lists all shared VPC host projects visible to the user in an organization.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   ListXpnHostsProjectsRequest request =
       ListXpnHostsProjectsRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setProjectsListXpnHostsRequestResource(
               ProjectsListXpnHostsRequest.newBuilder().build())
           .setReturnPartialSuccess(true)
           .build();
   for (Project element : projectsClient.listXpnHosts(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListXpnHostsProjectsRequest

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

Returns
TypeDescription
ProjectsClient.ListXpnHostsPagedResponse

listXpnHosts(String project, ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource)

public final ProjectsClient.ListXpnHostsPagedResponse listXpnHosts(String project, ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource)

Lists all shared VPC host projects visible to the user in an organization.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource =
       ProjectsListXpnHostsRequest.newBuilder().build();
   for (Project element :
       projectsClient.listXpnHosts(project, projectsListXpnHostsRequestResource).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

projectsListXpnHostsRequestResourceProjectsListXpnHostsRequest

The body resource for this request

Returns
TypeDescription
ProjectsClient.ListXpnHostsPagedResponse

listXpnHostsCallable()

public final UnaryCallable<ListXpnHostsProjectsRequest,XpnHostList> listXpnHostsCallable()

Lists all shared VPC host projects visible to the user in an organization.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   ListXpnHostsProjectsRequest request =
       ListXpnHostsProjectsRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setProjectsListXpnHostsRequestResource(
               ProjectsListXpnHostsRequest.newBuilder().build())
           .setReturnPartialSuccess(true)
           .build();
   while (true) {
     XpnHostList response = projectsClient.listXpnHostsCallable().call(request);
     for (Project element : response.getItemsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListXpnHostsProjectsRequest,XpnHostList>

listXpnHostsPagedCallable()

public final UnaryCallable<ListXpnHostsProjectsRequest,ProjectsClient.ListXpnHostsPagedResponse> listXpnHostsPagedCallable()

Lists all shared VPC host projects visible to the user in an organization.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   ListXpnHostsProjectsRequest request =
       ListXpnHostsProjectsRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setProjectsListXpnHostsRequestResource(
               ProjectsListXpnHostsRequest.newBuilder().build())
           .setReturnPartialSuccess(true)
           .build();
   ApiFuture<Project> future = projectsClient.listXpnHostsPagedCallable().futureCall(request);
   // Do something.
   for (Project element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListXpnHostsProjectsRequest,ListXpnHostsPagedResponse>

moveDiskAsync(MoveDiskProjectRequest request)

public final OperationFuture<Operation,Operation> moveDiskAsync(MoveDiskProjectRequest request)

Moves a persistent disk from one zone to another.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   MoveDiskProjectRequest request =
       MoveDiskProjectRequest.newBuilder()
           .setDiskMoveRequestResource(DiskMoveRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = projectsClient.moveDiskAsync(request).get();
 }
 
Parameter
NameDescription
requestMoveDiskProjectRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

moveDiskAsync(String project, DiskMoveRequest diskMoveRequestResource)

public final OperationFuture<Operation,Operation> moveDiskAsync(String project, DiskMoveRequest diskMoveRequestResource)

Moves a persistent disk from one zone to another.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   DiskMoveRequest diskMoveRequestResource = DiskMoveRequest.newBuilder().build();
   Operation response = projectsClient.moveDiskAsync(project, diskMoveRequestResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

diskMoveRequestResourceDiskMoveRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

moveDiskCallable()

public final UnaryCallable<MoveDiskProjectRequest,Operation> moveDiskCallable()

Moves a persistent disk from one zone to another.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   MoveDiskProjectRequest request =
       MoveDiskProjectRequest.newBuilder()
           .setDiskMoveRequestResource(DiskMoveRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = projectsClient.moveDiskCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<MoveDiskProjectRequest,Operation>

moveDiskOperationCallable()

public final OperationCallable<MoveDiskProjectRequest,Operation,Operation> moveDiskOperationCallable()

Moves a persistent disk from one zone to another.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   MoveDiskProjectRequest request =
       MoveDiskProjectRequest.newBuilder()
           .setDiskMoveRequestResource(DiskMoveRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       projectsClient.moveDiskOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<MoveDiskProjectRequest,Operation,Operation>

moveInstanceAsync(MoveInstanceProjectRequest request)

public final OperationFuture<Operation,Operation> moveInstanceAsync(MoveInstanceProjectRequest request)

Moves an instance and its attached persistent disks from one zone to another. *Note*: Moving VMs or disks by using this method might cause unexpected behavior. For more information, see the known issue.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   MoveInstanceProjectRequest request =
       MoveInstanceProjectRequest.newBuilder()
           .setInstanceMoveRequestResource(InstanceMoveRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = projectsClient.moveInstanceAsync(request).get();
 }
 
Parameter
NameDescription
requestMoveInstanceProjectRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

moveInstanceAsync(String project, InstanceMoveRequest instanceMoveRequestResource)

public final OperationFuture<Operation,Operation> moveInstanceAsync(String project, InstanceMoveRequest instanceMoveRequestResource)

Moves an instance and its attached persistent disks from one zone to another. *Note*: Moving VMs or disks by using this method might cause unexpected behavior. For more information, see the known issue.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   InstanceMoveRequest instanceMoveRequestResource = InstanceMoveRequest.newBuilder().build();
   Operation response =
       projectsClient.moveInstanceAsync(project, instanceMoveRequestResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

instanceMoveRequestResourceInstanceMoveRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

moveInstanceCallable()

public final UnaryCallable<MoveInstanceProjectRequest,Operation> moveInstanceCallable()

Moves an instance and its attached persistent disks from one zone to another. *Note*: Moving VMs or disks by using this method might cause unexpected behavior. For more information, see the known issue.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   MoveInstanceProjectRequest request =
       MoveInstanceProjectRequest.newBuilder()
           .setInstanceMoveRequestResource(InstanceMoveRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = projectsClient.moveInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<MoveInstanceProjectRequest,Operation>

moveInstanceOperationCallable()

public final OperationCallable<MoveInstanceProjectRequest,Operation,Operation> moveInstanceOperationCallable()

Moves an instance and its attached persistent disks from one zone to another. *Note*: Moving VMs or disks by using this method might cause unexpected behavior. For more information, see the known issue.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   MoveInstanceProjectRequest request =
       MoveInstanceProjectRequest.newBuilder()
           .setInstanceMoveRequestResource(InstanceMoveRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       projectsClient.moveInstanceOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<MoveInstanceProjectRequest,Operation,Operation>

setCommonInstanceMetadataAsync(SetCommonInstanceMetadataProjectRequest request)

public final OperationFuture<Operation,Operation> setCommonInstanceMetadataAsync(SetCommonInstanceMetadataProjectRequest request)

Sets metadata common to all instances within the specified project using the data included in the 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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   SetCommonInstanceMetadataProjectRequest request =
       SetCommonInstanceMetadataProjectRequest.newBuilder()
           .setMetadataResource(Metadata.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   Operation response = projectsClient.setCommonInstanceMetadataAsync(request).get();
 }
 
Parameter
NameDescription
requestSetCommonInstanceMetadataProjectRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

setCommonInstanceMetadataAsync(String project, Metadata metadataResource)

public final OperationFuture<Operation,Operation> setCommonInstanceMetadataAsync(String project, Metadata metadataResource)

Sets metadata common to all instances within the specified project using the data included in the 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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   Metadata metadataResource = Metadata.newBuilder().build();
   Operation response =
       projectsClient.setCommonInstanceMetadataAsync(project, metadataResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

metadataResourceMetadata

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setCommonInstanceMetadataCallable()

public final UnaryCallable<SetCommonInstanceMetadataProjectRequest,Operation> setCommonInstanceMetadataCallable()

Sets metadata common to all instances within the specified project using the data included in the 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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   SetCommonInstanceMetadataProjectRequest request =
       SetCommonInstanceMetadataProjectRequest.newBuilder()
           .setMetadataResource(Metadata.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       projectsClient.setCommonInstanceMetadataCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetCommonInstanceMetadataProjectRequest,Operation>

setCommonInstanceMetadataOperationCallable()

public final OperationCallable<SetCommonInstanceMetadataProjectRequest,Operation,Operation> setCommonInstanceMetadataOperationCallable()

Sets metadata common to all instances within the specified project using the data included in the 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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   SetCommonInstanceMetadataProjectRequest request =
       SetCommonInstanceMetadataProjectRequest.newBuilder()
           .setMetadataResource(Metadata.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       projectsClient.setCommonInstanceMetadataOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetCommonInstanceMetadataProjectRequest,Operation,Operation>

setDefaultNetworkTierAsync(SetDefaultNetworkTierProjectRequest request)

public final OperationFuture<Operation,Operation> setDefaultNetworkTierAsync(SetDefaultNetworkTierProjectRequest request)

Sets the default network tier of the project. The default network tier is used when an address/forwardingRule/instance is created without specifying the network tier field.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   SetDefaultNetworkTierProjectRequest request =
       SetDefaultNetworkTierProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setProjectsSetDefaultNetworkTierRequestResource(
               ProjectsSetDefaultNetworkTierRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Operation response = projectsClient.setDefaultNetworkTierAsync(request).get();
 }
 
Parameter
NameDescription
requestSetDefaultNetworkTierProjectRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

setDefaultNetworkTierAsync(String project, ProjectsSetDefaultNetworkTierRequest projectsSetDefaultNetworkTierRequestResource)

public final OperationFuture<Operation,Operation> setDefaultNetworkTierAsync(String project, ProjectsSetDefaultNetworkTierRequest projectsSetDefaultNetworkTierRequestResource)

Sets the default network tier of the project. The default network tier is used when an address/forwardingRule/instance is created without specifying the network tier field.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   ProjectsSetDefaultNetworkTierRequest projectsSetDefaultNetworkTierRequestResource =
       ProjectsSetDefaultNetworkTierRequest.newBuilder().build();
   Operation response =
       projectsClient
           .setDefaultNetworkTierAsync(project, projectsSetDefaultNetworkTierRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

projectsSetDefaultNetworkTierRequestResourceProjectsSetDefaultNetworkTierRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setDefaultNetworkTierCallable()

public final UnaryCallable<SetDefaultNetworkTierProjectRequest,Operation> setDefaultNetworkTierCallable()

Sets the default network tier of the project. The default network tier is used when an address/forwardingRule/instance is created without specifying the network tier field.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   SetDefaultNetworkTierProjectRequest request =
       SetDefaultNetworkTierProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setProjectsSetDefaultNetworkTierRequestResource(
               ProjectsSetDefaultNetworkTierRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       projectsClient.setDefaultNetworkTierCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetDefaultNetworkTierProjectRequest,Operation>

setDefaultNetworkTierOperationCallable()

public final OperationCallable<SetDefaultNetworkTierProjectRequest,Operation,Operation> setDefaultNetworkTierOperationCallable()

Sets the default network tier of the project. The default network tier is used when an address/forwardingRule/instance is created without specifying the network tier field.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   SetDefaultNetworkTierProjectRequest request =
       SetDefaultNetworkTierProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setProjectsSetDefaultNetworkTierRequestResource(
               ProjectsSetDefaultNetworkTierRequest.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       projectsClient.setDefaultNetworkTierOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetDefaultNetworkTierProjectRequest,Operation,Operation>

setUsageExportBucketAsync(SetUsageExportBucketProjectRequest request)

public final OperationFuture<Operation,Operation> setUsageExportBucketAsync(SetUsageExportBucketProjectRequest request)

Enables the usage export feature and sets the usage export bucket where reports are stored. If you provide an empty request body using this method, the usage export feature will be disabled.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   SetUsageExportBucketProjectRequest request =
       SetUsageExportBucketProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setUsageExportLocationResource(UsageExportLocation.newBuilder().build())
           .build();
   Operation response = projectsClient.setUsageExportBucketAsync(request).get();
 }
 
Parameter
NameDescription
requestSetUsageExportBucketProjectRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

setUsageExportBucketAsync(String project, UsageExportLocation usageExportLocationResource)

public final OperationFuture<Operation,Operation> setUsageExportBucketAsync(String project, UsageExportLocation usageExportLocationResource)

Enables the usage export feature and sets the usage export bucket where reports are stored. If you provide an empty request body using this method, the usage export feature will be disabled.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   String project = "project-309310695";
   UsageExportLocation usageExportLocationResource = UsageExportLocation.newBuilder().build();
   Operation response =
       projectsClient.setUsageExportBucketAsync(project, usageExportLocationResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

usageExportLocationResourceUsageExportLocation

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setUsageExportBucketCallable()

public final UnaryCallable<SetUsageExportBucketProjectRequest,Operation> setUsageExportBucketCallable()

Enables the usage export feature and sets the usage export bucket where reports are stored. If you provide an empty request body using this method, the usage export feature will be disabled.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   SetUsageExportBucketProjectRequest request =
       SetUsageExportBucketProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setUsageExportLocationResource(UsageExportLocation.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       projectsClient.setUsageExportBucketCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetUsageExportBucketProjectRequest,Operation>

setUsageExportBucketOperationCallable()

public final OperationCallable<SetUsageExportBucketProjectRequest,Operation,Operation> setUsageExportBucketOperationCallable()

Enables the usage export feature and sets the usage export bucket where reports are stored. If you provide an empty request body using this method, the usage export feature will be disabled.

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 (ProjectsClient projectsClient = ProjectsClient.create()) {
   SetUsageExportBucketProjectRequest request =
       SetUsageExportBucketProjectRequest.newBuilder()
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setUsageExportLocationResource(UsageExportLocation.newBuilder().build())
           .build();
   OperationFuture<Operation, Operation> future =
       projectsClient.setUsageExportBucketOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetUsageExportBucketProjectRequest,Operation,Operation>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()