Class HostProjectRegistrationServiceClient

java.lang.Object
com.google.cloud.apihub.v1.HostProjectRegistrationServiceClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class HostProjectRegistrationServiceClient extends Object implements BackgroundResource
Service Description: This service is used for managing the host project registrations.

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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
     HostProjectRegistrationServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   HostProjectRegistration hostProjectRegistration =
       HostProjectRegistration.newBuilder().build();
   String hostProjectRegistrationId = "hostProjectRegistrationId1352651365";
   HostProjectRegistration response =
       hostProjectRegistrationServiceClient.createHostProjectRegistration(
           parent, hostProjectRegistration, hostProjectRegistrationId);
 }
 

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

Methods
Method Description Method Variants

CreateHostProjectRegistration

Create a host project registration. A Google cloud project can be registered as a host project if it is not attached as a runtime project to another host project. A project can be registered as a host project only once. Subsequent register calls for the same project will fail.

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

  • createHostProjectRegistration(CreateHostProjectRegistrationRequest request)

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

  • createHostProjectRegistration(LocationName parent, HostProjectRegistration hostProjectRegistration, String hostProjectRegistrationId)

  • createHostProjectRegistration(String parent, HostProjectRegistration hostProjectRegistration, String hostProjectRegistrationId)

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

  • createHostProjectRegistrationCallable()

GetHostProjectRegistration

Get a host project registration.

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

  • getHostProjectRegistration(GetHostProjectRegistrationRequest request)

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

  • getHostProjectRegistration(HostProjectRegistrationName name)

  • getHostProjectRegistration(String name)

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

  • getHostProjectRegistrationCallable()

ListHostProjectRegistrations

Lists host project registrations.

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

  • listHostProjectRegistrations(ListHostProjectRegistrationsRequest request)

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

  • listHostProjectRegistrations(LocationName parent)

  • listHostProjectRegistrations(String parent)

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

  • listHostProjectRegistrationsPagedCallable()

  • listHostProjectRegistrationsCallable()

ListLocations

Lists information about the supported locations for this service.

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

  • listLocations(ListLocationsRequest request)

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

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

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

  • getLocation(GetLocationRequest request)

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

  • getLocationCallable()

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 HostProjectRegistrationServiceSettings 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
 HostProjectRegistrationServiceSettings hostProjectRegistrationServiceSettings =
     HostProjectRegistrationServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
     HostProjectRegistrationServiceClient.create(hostProjectRegistrationServiceSettings);
 

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
 HostProjectRegistrationServiceSettings hostProjectRegistrationServiceSettings =
     HostProjectRegistrationServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
     HostProjectRegistrationServiceClient.create(hostProjectRegistrationServiceSettings);
 

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

  • Constructor Details

    • HostProjectRegistrationServiceClient

      protected HostProjectRegistrationServiceClient(HostProjectRegistrationServiceSettings settings) throws IOException
      Constructs an instance of HostProjectRegistrationServiceClient, 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
    • HostProjectRegistrationServiceClient

      protected HostProjectRegistrationServiceClient(HostProjectRegistrationServiceStub stub)
  • Method Details

    • create

      public static final HostProjectRegistrationServiceClient create() throws IOException
      Constructs an instance of HostProjectRegistrationServiceClient with default settings.
      Throws:
      IOException
    • create

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

      Constructs an instance of HostProjectRegistrationServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(HostProjectRegistrationServiceSettings).
    • getSettings

      public final HostProjectRegistrationServiceSettings getSettings()
    • getStub

    • createHostProjectRegistration

      public final HostProjectRegistration createHostProjectRegistration(LocationName parent, HostProjectRegistration hostProjectRegistration, String hostProjectRegistrationId)
      Create a host project registration. A Google cloud project can be registered as a host project if it is not attached as a runtime project to another host project. A project can be registered as a host project only once. Subsequent register calls for the same project will fail.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         HostProjectRegistration hostProjectRegistration =
             HostProjectRegistration.newBuilder().build();
         String hostProjectRegistrationId = "hostProjectRegistrationId1352651365";
         HostProjectRegistration response =
             hostProjectRegistrationServiceClient.createHostProjectRegistration(
                 parent, hostProjectRegistration, hostProjectRegistrationId);
       }
       
      Parameters:
      parent - Required. The parent resource for the host project. Format: `projects/{project}/locations/{location}`
      hostProjectRegistration - Required. The host project registration to register.
      hostProjectRegistrationId - Required. The ID to use for the Host Project Registration, which will become the final component of the host project registration's resource name. The ID must be the same as the Google cloud project specified in the host_project_registration.gcp_project field.
      Throws:
      ApiException - if the remote call fails
    • createHostProjectRegistration

      public final HostProjectRegistration createHostProjectRegistration(String parent, HostProjectRegistration hostProjectRegistration, String hostProjectRegistrationId)
      Create a host project registration. A Google cloud project can be registered as a host project if it is not attached as a runtime project to another host project. A project can be registered as a host project only once. Subsequent register calls for the same project will fail.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         HostProjectRegistration hostProjectRegistration =
             HostProjectRegistration.newBuilder().build();
         String hostProjectRegistrationId = "hostProjectRegistrationId1352651365";
         HostProjectRegistration response =
             hostProjectRegistrationServiceClient.createHostProjectRegistration(
                 parent, hostProjectRegistration, hostProjectRegistrationId);
       }
       
      Parameters:
      parent - Required. The parent resource for the host project. Format: `projects/{project}/locations/{location}`
      hostProjectRegistration - Required. The host project registration to register.
      hostProjectRegistrationId - Required. The ID to use for the Host Project Registration, which will become the final component of the host project registration's resource name. The ID must be the same as the Google cloud project specified in the host_project_registration.gcp_project field.
      Throws:
      ApiException - if the remote call fails
    • createHostProjectRegistration

      public final HostProjectRegistration createHostProjectRegistration(CreateHostProjectRegistrationRequest request)
      Create a host project registration. A Google cloud project can be registered as a host project if it is not attached as a runtime project to another host project. A project can be registered as a host project only once. Subsequent register calls for the same project will fail.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         CreateHostProjectRegistrationRequest request =
             CreateHostProjectRegistrationRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setHostProjectRegistrationId("hostProjectRegistrationId1352651365")
                 .setHostProjectRegistration(HostProjectRegistration.newBuilder().build())
                 .build();
         HostProjectRegistration response =
             hostProjectRegistrationServiceClient.createHostProjectRegistration(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createHostProjectRegistrationCallable

      public final UnaryCallable<CreateHostProjectRegistrationRequest,HostProjectRegistration> createHostProjectRegistrationCallable()
      Create a host project registration. A Google cloud project can be registered as a host project if it is not attached as a runtime project to another host project. A project can be registered as a host project only once. Subsequent register calls for the same project will fail.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         CreateHostProjectRegistrationRequest request =
             CreateHostProjectRegistrationRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setHostProjectRegistrationId("hostProjectRegistrationId1352651365")
                 .setHostProjectRegistration(HostProjectRegistration.newBuilder().build())
                 .build();
         ApiFuture<HostProjectRegistration> future =
             hostProjectRegistrationServiceClient
                 .createHostProjectRegistrationCallable()
                 .futureCall(request);
         // Do something.
         HostProjectRegistration response = future.get();
       }
       
    • getHostProjectRegistration

      public final HostProjectRegistration getHostProjectRegistration(HostProjectRegistrationName name)
      Get a host project registration.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         HostProjectRegistrationName name =
             HostProjectRegistrationName.of("[PROJECT]", "[LOCATION]", "[HOST_PROJECT_REGISTRATION]");
         HostProjectRegistration response =
             hostProjectRegistrationServiceClient.getHostProjectRegistration(name);
       }
       
      Parameters:
      name - Required. Host project registration resource name. projects/{project}/locations/{location}/hostProjectRegistrations/{host_project_registration_id}
      Throws:
      ApiException - if the remote call fails
    • getHostProjectRegistration

      public final HostProjectRegistration getHostProjectRegistration(String name)
      Get a host project registration.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         String name =
             HostProjectRegistrationName.of("[PROJECT]", "[LOCATION]", "[HOST_PROJECT_REGISTRATION]")
                 .toString();
         HostProjectRegistration response =
             hostProjectRegistrationServiceClient.getHostProjectRegistration(name);
       }
       
      Parameters:
      name - Required. Host project registration resource name. projects/{project}/locations/{location}/hostProjectRegistrations/{host_project_registration_id}
      Throws:
      ApiException - if the remote call fails
    • getHostProjectRegistration

      public final HostProjectRegistration getHostProjectRegistration(GetHostProjectRegistrationRequest request)
      Get a host project registration.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         GetHostProjectRegistrationRequest request =
             GetHostProjectRegistrationRequest.newBuilder()
                 .setName(
                     HostProjectRegistrationName.of(
                             "[PROJECT]", "[LOCATION]", "[HOST_PROJECT_REGISTRATION]")
                         .toString())
                 .build();
         HostProjectRegistration response =
             hostProjectRegistrationServiceClient.getHostProjectRegistration(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getHostProjectRegistrationCallable

      public final UnaryCallable<GetHostProjectRegistrationRequest,HostProjectRegistration> getHostProjectRegistrationCallable()
      Get a host project registration.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         GetHostProjectRegistrationRequest request =
             GetHostProjectRegistrationRequest.newBuilder()
                 .setName(
                     HostProjectRegistrationName.of(
                             "[PROJECT]", "[LOCATION]", "[HOST_PROJECT_REGISTRATION]")
                         .toString())
                 .build();
         ApiFuture<HostProjectRegistration> future =
             hostProjectRegistrationServiceClient
                 .getHostProjectRegistrationCallable()
                 .futureCall(request);
         // Do something.
         HostProjectRegistration response = future.get();
       }
       
    • listHostProjectRegistrations

      Lists host project registrations.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         for (HostProjectRegistration element :
             hostProjectRegistrationServiceClient.listHostProjectRegistrations(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent, which owns this collection of host projects. Format: `projects/*/locations/*`
      Throws:
      ApiException - if the remote call fails
    • listHostProjectRegistrations

      Lists host project registrations.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         for (HostProjectRegistration element :
             hostProjectRegistrationServiceClient.listHostProjectRegistrations(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent, which owns this collection of host projects. Format: `projects/*/locations/*`
      Throws:
      ApiException - if the remote call fails
    • listHostProjectRegistrations

      Lists host project registrations.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         ListHostProjectRegistrationsRequest request =
             ListHostProjectRegistrationsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         for (HostProjectRegistration element :
             hostProjectRegistrationServiceClient.listHostProjectRegistrations(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listHostProjectRegistrationsPagedCallable

      Lists host project registrations.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         ListHostProjectRegistrationsRequest request =
             ListHostProjectRegistrationsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         ApiFuture<HostProjectRegistration> future =
             hostProjectRegistrationServiceClient
                 .listHostProjectRegistrationsPagedCallable()
                 .futureCall(request);
         // Do something.
         for (HostProjectRegistration element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listHostProjectRegistrationsCallable

      public final UnaryCallable<ListHostProjectRegistrationsRequest,ListHostProjectRegistrationsResponse> listHostProjectRegistrationsCallable()
      Lists host project registrations.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         ListHostProjectRegistrationsRequest request =
             ListHostProjectRegistrationsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         while (true) {
           ListHostProjectRegistrationsResponse response =
               hostProjectRegistrationServiceClient
                   .listHostProjectRegistrationsCallable()
                   .call(request);
           for (HostProjectRegistration element : response.getHostProjectRegistrationsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • listLocations

      Lists information about the supported locations for this service.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Location element :
             hostProjectRegistrationServiceClient.listLocations(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listLocationsPagedCallable

      Lists information about the supported locations for this service.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Location> future =
             hostProjectRegistrationServiceClient.listLocationsPagedCallable().futureCall(request);
         // Do something.
         for (Location element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listLocationsCallable

      public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()
      Lists information about the supported locations for this service.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListLocationsResponse response =
               hostProjectRegistrationServiceClient.listLocationsCallable().call(request);
           for (Location element : response.getLocationsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getLocation

      public final Location getLocation(GetLocationRequest request)
      Gets information about a location.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         Location response = hostProjectRegistrationServiceClient.getLocation(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getLocationCallable

      public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()
      Gets information about a location.

      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 (HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
           HostProjectRegistrationServiceClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         ApiFuture<Location> future =
             hostProjectRegistrationServiceClient.getLocationCallable().futureCall(request);
         // Do something.
         Location response = future.get();
       }
       
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface BackgroundResource
      Throws:
      InterruptedException