Class HubServiceClient
- 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) {
HubName name = HubName.of("[PROJECT]", "[HUB]");
Hub response = hubServiceClient.getHub(name);
}
Note: close() needs to be called on the HubServiceClient 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 |
|---|---|---|
ListHubs |
Lists Hubs in a given project and location. |
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.
|
GetHub |
Gets details of a single Hub. |
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.
|
CreateHub |
Creates a new Hub in a given project and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateHub |
Updates the parameters of a single Hub. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteHub |
Deletes a single Hub. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListSpokes |
Lists Spokes in a given project and location. |
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.
|
GetSpoke |
Gets details of a single Spoke. |
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.
|
CreateSpoke |
Creates a new Spoke in a given project and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateSpoke |
Updates the parameters of a single Spoke. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteSpoke |
Deletes a single Spoke. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
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 HubServiceSettings 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
HubServiceSettings hubServiceSettings =
HubServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
HubServiceClient hubServiceClient = HubServiceClient.create(hubServiceSettings);
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
HubServiceSettings hubServiceSettings =
HubServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
HubServiceClient hubServiceClient = HubServiceClient.create(hubServiceSettings);
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
ConstructorsModifierConstructorDescriptionprotectedHubServiceClient(HubServiceSettings settings) Constructs an instance of HubServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final HubServiceClientcreate()Constructs an instance of HubServiceClient with default settings.static final HubServiceClientcreate(HubServiceSettings settings) Constructs an instance of HubServiceClient, using the given settings.static final HubServiceClientcreate(HubServiceStub stub) Constructs an instance of HubServiceClient, using the given stub for making calls.final OperationFuture<Hub,OperationMetadata> createHubAsync(CreateHubRequest request) Creates a new Hub in a given project and location.final OperationFuture<Hub,OperationMetadata> createHubAsync(LocationName parent, Hub hub, String hubId) Creates a new Hub in a given project and location.final OperationFuture<Hub,OperationMetadata> createHubAsync(String parent, Hub hub, String hubId) Creates a new Hub in a given project and location.Creates a new Hub in a given project and location.Creates a new Hub in a given project and location.createSpokeAsync(CreateSpokeRequest request) Creates a new Spoke in a given project and location.createSpokeAsync(LocationName parent, Spoke spoke, String spokeId) Creates a new Spoke in a given project and location.createSpokeAsync(String parent, Spoke spoke, String spokeId) Creates a new Spoke in a given project and location.Creates a new Spoke in a given project and location.Creates a new Spoke in a given project and location.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteHubAsync(DeleteHubRequest request) Deletes a single Hub.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteHubAsync(HubName name) Deletes a single Hub.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteHubAsync(String name) Deletes a single Hub.Deletes a single Hub.final OperationCallable<DeleteHubRequest,com.google.protobuf.Empty, OperationMetadata> Deletes a single Hub.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteSpokeAsync(DeleteSpokeRequest request) Deletes a single Spoke.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteSpokeAsync(SpokeName name) Deletes a single Spoke.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteSpokeAsync(String name) Deletes a single Spoke.Deletes a single Spoke.final OperationCallable<DeleteSpokeRequest,com.google.protobuf.Empty, OperationMetadata> Deletes a single Spoke.final HubgetHub(GetHubRequest request) Gets details of a single Hub.final HubGets details of a single Hub.final HubGets details of a single Hub.final UnaryCallable<GetHubRequest,Hub> Gets details of a single Hub.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final HubServiceSettingsfinal SpokegetSpoke(GetSpokeRequest request) Gets details of a single Spoke.final SpokeGets details of a single Spoke.final SpokeGets details of a single Spoke.final UnaryCallable<GetSpokeRequest,Spoke> Gets details of a single Spoke.getStub()booleanbooleanlistHubs(ListHubsRequest request) Lists Hubs in a given project and location.listHubs(LocationName parent) Lists Hubs in a given project and location.Lists Hubs in a given project and location.Lists Hubs in a given project and location.Lists Hubs in a given project and location.listSpokes(ListSpokesRequest request) Lists Spokes in a given project and location.listSpokes(LocationName parent) Lists Spokes in a given project and location.listSpokes(String parent) Lists Spokes in a given project and location.Lists Spokes in a given project and location.Lists Spokes in a given project and location.voidshutdown()voidfinal OperationFuture<Hub,OperationMetadata> updateHubAsync(Hub hub, com.google.protobuf.FieldMask updateMask) Updates the parameters of a single Hub.final OperationFuture<Hub,OperationMetadata> updateHubAsync(UpdateHubRequest request) Updates the parameters of a single Hub.Updates the parameters of a single Hub.Updates the parameters of a single Hub.updateSpokeAsync(Spoke spoke, com.google.protobuf.FieldMask updateMask) Updates the parameters of a single Spoke.updateSpokeAsync(UpdateSpokeRequest request) Updates the parameters of a single Spoke.Updates the parameters of a single Spoke.Updates the parameters of a single Spoke.
-
Constructor Details
-
HubServiceClient
Constructs an instance of HubServiceClient, 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
-
HubServiceClient
-
-
Method Details
-
create
Constructs an instance of HubServiceClient with default settings.- Throws:
IOException
-
create
Constructs an instance of HubServiceClient, 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 HubServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(HubServiceSettings). -
getSettings
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
listHubs
Lists Hubs in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (Hub element : hubServiceClient.listHubs(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent resource's name.- Throws:
ApiException- if the remote call fails
-
listHubs
Lists Hubs in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Hub element : hubServiceClient.listHubs(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent resource's name.- Throws:
ApiException- if the remote call fails
-
listHubs
Lists Hubs in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { ListHubsRequest request = ListHubsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); for (Hub element : hubServiceClient.listHubs(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
-
listHubsPagedCallable
public final UnaryCallable<ListHubsRequest,HubServiceClient.ListHubsPagedResponse> listHubsPagedCallable()Lists Hubs in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { ListHubsRequest request = ListHubsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); ApiFuture<Hub> future = hubServiceClient.listHubsPagedCallable().futureCall(request); // Do something. for (Hub element : future.get().iterateAll()) { // doThingsWith(element); } } -
listHubsCallable
Lists Hubs in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { ListHubsRequest request = ListHubsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); while (true) { ListHubsResponse response = hubServiceClient.listHubsCallable().call(request); for (Hub element : response.getHubsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getHub
Gets details of a single Hub.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { HubName name = HubName.of("[PROJECT]", "[HUB]"); Hub response = hubServiceClient.getHub(name); }- Parameters:
name- Required. Name of the Hub resource to get.- Throws:
ApiException- if the remote call fails
-
getHub
Gets details of a single Hub.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { String name = HubName.of("[PROJECT]", "[HUB]").toString(); Hub response = hubServiceClient.getHub(name); }- Parameters:
name- Required. Name of the Hub resource to get.- Throws:
ApiException- if the remote call fails
-
getHub
Gets details of a single Hub.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { GetHubRequest request = GetHubRequest.newBuilder().setName(HubName.of("[PROJECT]", "[HUB]").toString()).build(); Hub response = hubServiceClient.getHub(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getHubCallable
Gets details of a single Hub.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { GetHubRequest request = GetHubRequest.newBuilder().setName(HubName.of("[PROJECT]", "[HUB]").toString()).build(); ApiFuture<Hub> future = hubServiceClient.getHubCallable().futureCall(request); // Do something. Hub response = future.get(); } -
createHubAsync
public final OperationFuture<Hub,OperationMetadata> createHubAsync(LocationName parent, Hub hub, String hubId) Creates a new Hub in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Hub hub = Hub.newBuilder().build(); String hubId = "hubId99628272"; Hub response = hubServiceClient.createHubAsync(parent, hub, hubId).get(); }- Parameters:
parent- Required. The parent resource's name of the Hub.hub- Required. Initial values for a new Hub.hubId- Optional. Unique id for the Hub to create.- Throws:
ApiException- if the remote call fails
-
createHubAsync
public final OperationFuture<Hub,OperationMetadata> createHubAsync(String parent, Hub hub, String hubId) Creates a new Hub in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Hub hub = Hub.newBuilder().build(); String hubId = "hubId99628272"; Hub response = hubServiceClient.createHubAsync(parent, hub, hubId).get(); }- Parameters:
parent- Required. The parent resource's name of the Hub.hub- Required. Initial values for a new Hub.hubId- Optional. Unique id for the Hub to create.- Throws:
ApiException- if the remote call fails
-
createHubAsync
Creates a new Hub in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { CreateHubRequest request = CreateHubRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setHubId("hubId99628272") .setHub(Hub.newBuilder().build()) .setRequestId("requestId693933066") .build(); Hub response = hubServiceClient.createHubAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createHubOperationCallable
Creates a new Hub in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { CreateHubRequest request = CreateHubRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setHubId("hubId99628272") .setHub(Hub.newBuilder().build()) .setRequestId("requestId693933066") .build(); OperationFuture<Hub, OperationMetadata> future = hubServiceClient.createHubOperationCallable().futureCall(request); // Do something. Hub response = future.get(); } -
createHubCallable
Creates a new Hub in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { CreateHubRequest request = CreateHubRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setHubId("hubId99628272") .setHub(Hub.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = hubServiceClient.createHubCallable().futureCall(request); // Do something. Operation response = future.get(); } -
updateHubAsync
public final OperationFuture<Hub,OperationMetadata> updateHubAsync(Hub hub, com.google.protobuf.FieldMask updateMask) Updates the parameters of a single Hub.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { Hub hub = Hub.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Hub response = hubServiceClient.updateHubAsync(hub, updateMask).get(); }- Parameters:
hub- Required. The state that the Hub should be in after the update.updateMask- Optional. Field mask is used to specify the fields to be overwritten in the Hub resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.- Throws:
ApiException- if the remote call fails
-
updateHubAsync
Updates the parameters of a single Hub.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { UpdateHubRequest request = UpdateHubRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setHub(Hub.newBuilder().build()) .setRequestId("requestId693933066") .build(); Hub response = hubServiceClient.updateHubAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateHubOperationCallable
Updates the parameters of a single Hub.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { UpdateHubRequest request = UpdateHubRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setHub(Hub.newBuilder().build()) .setRequestId("requestId693933066") .build(); OperationFuture<Hub, OperationMetadata> future = hubServiceClient.updateHubOperationCallable().futureCall(request); // Do something. Hub response = future.get(); } -
updateHubCallable
Updates the parameters of a single Hub.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { UpdateHubRequest request = UpdateHubRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setHub(Hub.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = hubServiceClient.updateHubCallable().futureCall(request); // Do something. Operation response = future.get(); } -
deleteHubAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteHubAsync(HubName name) Deletes a single Hub.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { HubName name = HubName.of("[PROJECT]", "[HUB]"); hubServiceClient.deleteHubAsync(name).get(); }- Parameters:
name- Required. The name of the Hub to delete.- Throws:
ApiException- if the remote call fails
-
deleteHubAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteHubAsync(String name) Deletes a single Hub.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { String name = HubName.of("[PROJECT]", "[HUB]").toString(); hubServiceClient.deleteHubAsync(name).get(); }- Parameters:
name- Required. The name of the Hub to delete.- Throws:
ApiException- if the remote call fails
-
deleteHubAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteHubAsync(DeleteHubRequest request) Deletes a single Hub.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { DeleteHubRequest request = DeleteHubRequest.newBuilder() .setName(HubName.of("[PROJECT]", "[HUB]").toString()) .setRequestId("requestId693933066") .build(); hubServiceClient.deleteHubAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteHubOperationCallable
public final OperationCallable<DeleteHubRequest,com.google.protobuf.Empty, deleteHubOperationCallable()OperationMetadata> Deletes a single Hub.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { DeleteHubRequest request = DeleteHubRequest.newBuilder() .setName(HubName.of("[PROJECT]", "[HUB]").toString()) .setRequestId("requestId693933066") .build(); OperationFuture<Empty, OperationMetadata> future = hubServiceClient.deleteHubOperationCallable().futureCall(request); // Do something. future.get(); } -
deleteHubCallable
Deletes a single Hub.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { DeleteHubRequest request = DeleteHubRequest.newBuilder() .setName(HubName.of("[PROJECT]", "[HUB]").toString()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = hubServiceClient.deleteHubCallable().futureCall(request); // Do something. future.get(); } -
listSpokes
Lists Spokes in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (Spoke element : hubServiceClient.listSpokes(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent's resource name.- Throws:
ApiException- if the remote call fails
-
listSpokes
Lists Spokes in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Spoke element : hubServiceClient.listSpokes(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent's resource name.- Throws:
ApiException- if the remote call fails
-
listSpokes
Lists Spokes in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { ListSpokesRequest request = ListSpokesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); for (Spoke element : hubServiceClient.listSpokes(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
-
listSpokesPagedCallable
public final UnaryCallable<ListSpokesRequest,HubServiceClient.ListSpokesPagedResponse> listSpokesPagedCallable()Lists Spokes in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { ListSpokesRequest request = ListSpokesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); ApiFuture<Spoke> future = hubServiceClient.listSpokesPagedCallable().futureCall(request); // Do something. for (Spoke element : future.get().iterateAll()) { // doThingsWith(element); } } -
listSpokesCallable
Lists Spokes in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { ListSpokesRequest request = ListSpokesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); while (true) { ListSpokesResponse response = hubServiceClient.listSpokesCallable().call(request); for (Spoke element : response.getSpokesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getSpoke
Gets details of a single Spoke.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { SpokeName name = SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]"); Spoke response = hubServiceClient.getSpoke(name); }- Parameters:
name- Required. The name of Spoke resource.- Throws:
ApiException- if the remote call fails
-
getSpoke
Gets details of a single Spoke.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { String name = SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString(); Spoke response = hubServiceClient.getSpoke(name); }- Parameters:
name- Required. The name of Spoke resource.- Throws:
ApiException- if the remote call fails
-
getSpoke
Gets details of a single Spoke.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { GetSpokeRequest request = GetSpokeRequest.newBuilder() .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) .build(); Spoke response = hubServiceClient.getSpoke(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getSpokeCallable
Gets details of a single Spoke.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { GetSpokeRequest request = GetSpokeRequest.newBuilder() .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) .build(); ApiFuture<Spoke> future = hubServiceClient.getSpokeCallable().futureCall(request); // Do something. Spoke response = future.get(); } -
createSpokeAsync
public final OperationFuture<Spoke,OperationMetadata> createSpokeAsync(LocationName parent, Spoke spoke, String spokeId) Creates a new Spoke in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Spoke spoke = Spoke.newBuilder().build(); String spokeId = "spokeId-1998996281"; Spoke response = hubServiceClient.createSpokeAsync(parent, spoke, spokeId).get(); }- Parameters:
parent- Required. The parent's resource name of the Spoke.spoke- Required. Initial values for a new Hub.spokeId- Optional. Unique id for the Spoke to create.- Throws:
ApiException- if the remote call fails
-
createSpokeAsync
public final OperationFuture<Spoke,OperationMetadata> createSpokeAsync(String parent, Spoke spoke, String spokeId) Creates a new Spoke in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Spoke spoke = Spoke.newBuilder().build(); String spokeId = "spokeId-1998996281"; Spoke response = hubServiceClient.createSpokeAsync(parent, spoke, spokeId).get(); }- Parameters:
parent- Required. The parent's resource name of the Spoke.spoke- Required. Initial values for a new Hub.spokeId- Optional. Unique id for the Spoke to create.- Throws:
ApiException- if the remote call fails
-
createSpokeAsync
Creates a new Spoke in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { CreateSpokeRequest request = CreateSpokeRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setSpokeId("spokeId-1998996281") .setSpoke(Spoke.newBuilder().build()) .setRequestId("requestId693933066") .build(); Spoke response = hubServiceClient.createSpokeAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createSpokeOperationCallable
public final OperationCallable<CreateSpokeRequest,Spoke, createSpokeOperationCallable()OperationMetadata> Creates a new Spoke in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { CreateSpokeRequest request = CreateSpokeRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setSpokeId("spokeId-1998996281") .setSpoke(Spoke.newBuilder().build()) .setRequestId("requestId693933066") .build(); OperationFuture<Spoke, OperationMetadata> future = hubServiceClient.createSpokeOperationCallable().futureCall(request); // Do something. Spoke response = future.get(); } -
createSpokeCallable
Creates a new Spoke in a given project and 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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { CreateSpokeRequest request = CreateSpokeRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setSpokeId("spokeId-1998996281") .setSpoke(Spoke.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = hubServiceClient.createSpokeCallable().futureCall(request); // Do something. Operation response = future.get(); } -
updateSpokeAsync
public final OperationFuture<Spoke,OperationMetadata> updateSpokeAsync(Spoke spoke, com.google.protobuf.FieldMask updateMask) Updates the parameters of a single Spoke.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { Spoke spoke = Spoke.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Spoke response = hubServiceClient.updateSpokeAsync(spoke, updateMask).get(); }- Parameters:
spoke- Required. The state that the Spoke should be in after the update.updateMask- Optional. Field mask is used to specify the fields to be overwritten in the Spoke resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.- Throws:
ApiException- if the remote call fails
-
updateSpokeAsync
Updates the parameters of a single Spoke.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { UpdateSpokeRequest request = UpdateSpokeRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setSpoke(Spoke.newBuilder().build()) .setRequestId("requestId693933066") .build(); Spoke response = hubServiceClient.updateSpokeAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateSpokeOperationCallable
public final OperationCallable<UpdateSpokeRequest,Spoke, updateSpokeOperationCallable()OperationMetadata> Updates the parameters of a single Spoke.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { UpdateSpokeRequest request = UpdateSpokeRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setSpoke(Spoke.newBuilder().build()) .setRequestId("requestId693933066") .build(); OperationFuture<Spoke, OperationMetadata> future = hubServiceClient.updateSpokeOperationCallable().futureCall(request); // Do something. Spoke response = future.get(); } -
updateSpokeCallable
Updates the parameters of a single Spoke.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { UpdateSpokeRequest request = UpdateSpokeRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setSpoke(Spoke.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = hubServiceClient.updateSpokeCallable().futureCall(request); // Do something. Operation response = future.get(); } -
deleteSpokeAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteSpokeAsync(SpokeName name) Deletes a single Spoke.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { SpokeName name = SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]"); hubServiceClient.deleteSpokeAsync(name).get(); }- Parameters:
name- Required. The name of the Spoke to delete.- Throws:
ApiException- if the remote call fails
-
deleteSpokeAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteSpokeAsync(String name) Deletes a single Spoke.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { String name = SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString(); hubServiceClient.deleteSpokeAsync(name).get(); }- Parameters:
name- Required. The name of the Spoke to delete.- Throws:
ApiException- if the remote call fails
-
deleteSpokeAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteSpokeAsync(DeleteSpokeRequest request) Deletes a single Spoke.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { DeleteSpokeRequest request = DeleteSpokeRequest.newBuilder() .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) .setRequestId("requestId693933066") .build(); hubServiceClient.deleteSpokeAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteSpokeOperationCallable
public final OperationCallable<DeleteSpokeRequest,com.google.protobuf.Empty, deleteSpokeOperationCallable()OperationMetadata> Deletes a single Spoke.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { DeleteSpokeRequest request = DeleteSpokeRequest.newBuilder() .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) .setRequestId("requestId693933066") .build(); OperationFuture<Empty, OperationMetadata> future = hubServiceClient.deleteSpokeOperationCallable().futureCall(request); // Do something. future.get(); } -
deleteSpokeCallable
Deletes a single Spoke.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 (HubServiceClient hubServiceClient = HubServiceClient.create()) { DeleteSpokeRequest request = DeleteSpokeRequest.newBuilder() .setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = hubServiceClient.deleteSpokeCallable().futureCall(request); // Do something. 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
-