Class HostProjectRegistrationServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
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().
| 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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetHostProjectRegistration |
Get a host project registration. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListHostProjectRegistrations |
Lists host project registrations. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of HostProjectRegistrationServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final HostProjectRegistrationServiceClientcreate()Constructs an instance of HostProjectRegistrationServiceClient with default settings.static final HostProjectRegistrationServiceClientcreate(HostProjectRegistrationServiceSettings settings) Constructs an instance of HostProjectRegistrationServiceClient, using the given settings.static final HostProjectRegistrationServiceClientConstructs an instance of HostProjectRegistrationServiceClient, using the given stub for making calls.final HostProjectRegistrationCreate a host project registration.final HostProjectRegistrationcreateHostProjectRegistration(LocationName parent, HostProjectRegistration hostProjectRegistration, String hostProjectRegistrationId) Create a host project registration.final HostProjectRegistrationcreateHostProjectRegistration(String parent, HostProjectRegistration hostProjectRegistration, String hostProjectRegistrationId) Create a host project registration.Create a host project registration.final HostProjectRegistrationGet a host project registration.final HostProjectRegistrationGet a host project registration.final HostProjectRegistrationGet a host project registration.Get a host project registration.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.getStub()booleanbooleanLists host project registrations.Lists host project registrations.listHostProjectRegistrations(String parent) Lists host project registrations.Lists host project registrations.final UnaryCallable<ListHostProjectRegistrationsRequest,HostProjectRegistrationServiceClient.ListHostProjectRegistrationsPagedResponse> Lists host project registrations.listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.final UnaryCallable<ListLocationsRequest,HostProjectRegistrationServiceClient.ListLocationsPagedResponse> Lists information about the supported locations for this service.voidshutdown()void
-
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
-
-
Method Details
-
create
Constructs an instance of HostProjectRegistrationServiceClient with default settings.- Throws:
IOException
-
create
public static final HostProjectRegistrationServiceClient create(HostProjectRegistrationServiceSettings settings) throws IOException 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
public static final HostProjectRegistrationServiceClient create(HostProjectRegistrationServiceStub stub) Constructs an instance of HostProjectRegistrationServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(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
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
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
public final HostProjectRegistrationServiceClient.ListHostProjectRegistrationsPagedResponse listHostProjectRegistrations(LocationName parent) 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
public final HostProjectRegistrationServiceClient.ListHostProjectRegistrationsPagedResponse listHostProjectRegistrations(String parent) 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
public final HostProjectRegistrationServiceClient.ListHostProjectRegistrationsPagedResponse listHostProjectRegistrations(ListHostProjectRegistrationsRequest request) 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
public final UnaryCallable<ListHostProjectRegistrationsRequest,HostProjectRegistrationServiceClient.ListHostProjectRegistrationsPagedResponse> 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
public final HostProjectRegistrationServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request) 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
public final UnaryCallable<ListLocationsRequest,HostProjectRegistrationServiceClient.ListLocationsPagedResponse> 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
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
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
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:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-