Class ProjectsClient

  • All Implemented Interfaces:
    com.google.api.gax.core.BackgroundResource, AutoCloseable

    @Generated("by gapic-generator-java")
    public class ProjectsClient
    extends Object
    implements com.google.api.gax.core.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.

    • Constructor Detail

      • ProjectsClient

        protected ProjectsClient​(ProjectsSettings settings)
                          throws IOException
        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.
        Throws:
        IOException
      • ProjectsClient

        protected ProjectsClient​(ProjectsStub stub)
    • Method Detail

      • create

        public static final ProjectsClient create​(ProjectsSettings settings)
                                           throws IOException
        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.
        Throws:
        IOException
      • create

        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).
      • disableXpnHostAsync

        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        project - Project ID for this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • disableXpnHostAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • disableXpnHostOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • disableXpnHostCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • disableXpnResourceAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        projectsDisableXpnResourceRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • disableXpnResourceAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • disableXpnResourceOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • disableXpnResourceCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • enableXpnHostAsync

        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        project - Project ID for this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • enableXpnHostAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • enableXpnHostOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • enableXpnHostCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • enableXpnResourceAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        projectsEnableXpnResourceRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • enableXpnResourceAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • enableXpnResourceOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • enableXpnResourceCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • get

        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);
         }
         
        Parameters:
        project - Project ID for this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • get

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • getXpnHost

        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);
         }
         
        Parameters:
        project - Project ID for this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getXpnHost

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getXpnHostCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • getXpnResources

        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);
           }
         }
         
        Parameters:
        project - Project ID for this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getXpnResources

        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);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getXpnResourcesPagedCallable

        public final com.google.api.gax.rpc.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);
           }
         }
         
      • getXpnResourcesCallable

        public final com.google.api.gax.rpc.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;
             }
           }
         }
         
      • listXpnHosts

        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:
        project - Project ID for this request.
        projectsListXpnHostsRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listXpnHosts

        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);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listXpnHostsPagedCallable

        public final com.google.api.gax.rpc.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);
           }
         }
         
      • listXpnHostsCallable

        public final com.google.api.gax.rpc.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;
             }
           }
         }
         
      • moveDiskAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        diskMoveRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • moveDiskAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • moveDiskOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • moveDiskCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • moveInstanceAsync

        public final com.google.api.gax.longrunning.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](/compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_the_moveinstance_api_or_the_causes_unexpected_behavior). [Deprecated] This method is deprecated. See [moving instance across zones](/compute/docs/instances/moving-instance-across-zones) instead.

        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:
        project - Project ID for this request.
        instanceMoveRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • moveInstanceAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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](/compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_the_moveinstance_api_or_the_causes_unexpected_behavior). [Deprecated] This method is deprecated. See [moving instance across zones](/compute/docs/instances/moving-instance-across-zones) instead.

        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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • moveInstanceOperationCallable

        public final com.google.api.gax.rpc.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](/compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_the_moveinstance_api_or_the_causes_unexpected_behavior). [Deprecated] This method is deprecated. See [moving instance across zones](/compute/docs/instances/moving-instance-across-zones) instead.

        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();
         }
         
      • moveInstanceCallable

        public final com.google.api.gax.rpc.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](/compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_the_moveinstance_api_or_the_causes_unexpected_behavior). [Deprecated] This method is deprecated. See [moving instance across zones](/compute/docs/instances/moving-instance-across-zones) instead.

        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();
         }
         
      • setCommonInstanceMetadataAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        metadataResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setCommonInstanceMetadataAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setCommonInstanceMetadataOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setCommonInstanceMetadataCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setDefaultNetworkTierAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        projectsSetDefaultNetworkTierRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setDefaultNetworkTierAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setDefaultNetworkTierOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setDefaultNetworkTierCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setUsageExportBucketAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        usageExportLocationResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setUsageExportBucketAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setUsageExportBucketOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setUsageExportBucketCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface com.google.api.gax.core.BackgroundResource
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface com.google.api.gax.core.BackgroundResource
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface com.google.api.gax.core.BackgroundResource
      • shutdownNow

        public void shutdownNow()
        Specified by:
        shutdownNow in interface com.google.api.gax.core.BackgroundResource