GitHub Repository | Product Reference |
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().
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);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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.newHttpJsonBuilder().build();
HostProjectRegistrationServiceClient hostProjectRegistrationServiceClient =
HostProjectRegistrationServiceClient.create(hostProjectRegistrationServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final HostProjectRegistrationServiceClient create()
Constructs an instance of HostProjectRegistrationServiceClient with default settings.
Returns | |
---|---|
Type | Description |
HostProjectRegistrationServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(HostProjectRegistrationServiceSettings settings)
public static final HostProjectRegistrationServiceClient create(HostProjectRegistrationServiceSettings settings)
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.
Parameter | |
---|---|
Name | Description |
settings |
HostProjectRegistrationServiceSettings |
Returns | |
---|---|
Type | Description |
HostProjectRegistrationServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(HostProjectRegistrationServiceStub stub)
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).
Parameter | |
---|---|
Name | Description |
stub |
HostProjectRegistrationServiceStub |
Returns | |
---|---|
Type | Description |
HostProjectRegistrationServiceClient |
Constructors
HostProjectRegistrationServiceClient(HostProjectRegistrationServiceSettings settings)
protected HostProjectRegistrationServiceClient(HostProjectRegistrationServiceSettings settings)
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.
Parameter | |
---|---|
Name | Description |
settings |
HostProjectRegistrationServiceSettings |
HostProjectRegistrationServiceClient(HostProjectRegistrationServiceStub stub)
protected HostProjectRegistrationServiceClient(HostProjectRegistrationServiceStub stub)
Parameter | |
---|---|
Name | Description |
stub |
HostProjectRegistrationServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration |
long |
unit |
TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
close()
public final void close()
createHostProjectRegistration(CreateHostProjectRegistrationRequest request)
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);
}
Parameter | |
---|---|
Name | Description |
request |
CreateHostProjectRegistrationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
HostProjectRegistration |
createHostProjectRegistration(LocationName parent, HostProjectRegistration hostProjectRegistration, String hostProjectRegistrationId)
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 | |
---|---|
Name | Description |
parent |
LocationName Required. The parent resource for the host project. Format:
|
hostProjectRegistration |
HostProjectRegistration Required. The host project registration to register. |
hostProjectRegistrationId |
String 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. |
Returns | |
---|---|
Type | Description |
HostProjectRegistration |
createHostProjectRegistration(String parent, HostProjectRegistration hostProjectRegistration, String hostProjectRegistrationId)
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 | |
---|---|
Name | Description |
parent |
String Required. The parent resource for the host project. Format:
|
hostProjectRegistration |
HostProjectRegistration Required. The host project registration to register. |
hostProjectRegistrationId |
String 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. |
Returns | |
---|---|
Type | Description |
HostProjectRegistration |
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateHostProjectRegistrationRequest,HostProjectRegistration> |
getHostProjectRegistration(GetHostProjectRegistrationRequest request)
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);
}
Parameter | |
---|---|
Name | Description |
request |
GetHostProjectRegistrationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
HostProjectRegistration |
getHostProjectRegistration(HostProjectRegistrationName name)
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);
}
Parameter | |
---|---|
Name | Description |
name |
HostProjectRegistrationName Required. Host project registration resource name. projects/{project}/locations/{location}/hostProjectRegistrations/{host_project_registration_id} |
Returns | |
---|---|
Type | Description |
HostProjectRegistration |
getHostProjectRegistration(String name)
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);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. Host project registration resource name. projects/{project}/locations/{location}/hostProjectRegistrations/{host_project_registration_id} |
Returns | |
---|---|
Type | Description |
HostProjectRegistration |
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetHostProjectRegistrationRequest,HostProjectRegistration> |
getLocation(GetLocationRequest request)
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);
}
Parameter | |
---|---|
Name | Description |
request |
com.google.cloud.location.GetLocationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
com.google.cloud.location.Location |
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getSettings()
public final HostProjectRegistrationServiceSettings getSettings()
Returns | |
---|---|
Type | Description |
HostProjectRegistrationServiceSettings |
getStub()
public HostProjectRegistrationServiceStub getStub()
Returns | |
---|---|
Type | Description |
HostProjectRegistrationServiceStub |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listHostProjectRegistrations(ListHostProjectRegistrationsRequest request)
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);
}
}
Parameter | |
---|---|
Name | Description |
request |
ListHostProjectRegistrationsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
HostProjectRegistrationServiceClient.ListHostProjectRegistrationsPagedResponse |
listHostProjectRegistrations(LocationName parent)
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);
}
}
Parameter | |
---|---|
Name | Description |
parent |
LocationName Required. The parent, which owns this collection of host projects. Format:
|
Returns | |
---|---|
Type | Description |
HostProjectRegistrationServiceClient.ListHostProjectRegistrationsPagedResponse |
listHostProjectRegistrations(String parent)
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);
}
}
Parameter | |
---|---|
Name | Description |
parent |
String Required. The parent, which owns this collection of host projects. Format:
|
Returns | |
---|---|
Type | Description |
HostProjectRegistrationServiceClient.ListHostProjectRegistrationsPagedResponse |
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;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListHostProjectRegistrationsRequest,ListHostProjectRegistrationsResponse> |
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);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListHostProjectRegistrationsRequest,ListHostProjectRegistrationsPagedResponse> |
listLocations(ListLocationsRequest request)
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);
}
}
Parameter | |
---|---|
Name | Description |
request |
com.google.cloud.location.ListLocationsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
HostProjectRegistrationServiceClient.ListLocationsPagedResponse |
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;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
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);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()