@Generated(value="by gapic-generator-java") public class HubServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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().
The surface of this class includes several types of Java methods for each of the API's methods:
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
HubServiceClient.ListHubsFixedSizeCollection |
static class |
HubServiceClient.ListHubsPage |
static class |
HubServiceClient.ListHubsPagedResponse |
static class |
HubServiceClient.ListSpokesFixedSizeCollection |
static class |
HubServiceClient.ListSpokesPage |
static class |
HubServiceClient.ListSpokesPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
HubServiceClient(HubServiceSettings settings)
Constructs an instance of HubServiceClient, using the given settings.
|
protected |
HubServiceClient(HubServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static HubServiceClient |
create()
Constructs an instance of HubServiceClient with default settings.
|
static HubServiceClient |
create(HubServiceSettings settings)
Constructs an instance of HubServiceClient, using the given settings.
|
static HubServiceClient |
create(HubServiceStub stub)
Constructs an instance of HubServiceClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Hub,OperationMetadata> |
createHubAsync(CreateHubRequest request)
Creates a new Network Connectivity Center hub in the specified project.
|
com.google.api.gax.longrunning.OperationFuture<Hub,OperationMetadata> |
createHubAsync(LocationName parent,
Hub hub,
String hubId)
Creates a new Network Connectivity Center hub in the specified project.
|
com.google.api.gax.longrunning.OperationFuture<Hub,OperationMetadata> |
createHubAsync(String parent,
Hub hub,
String hubId)
Creates a new Network Connectivity Center hub in the specified project.
|
com.google.api.gax.rpc.UnaryCallable<CreateHubRequest,com.google.longrunning.Operation> |
createHubCallable()
Creates a new Network Connectivity Center hub in the specified project.
|
com.google.api.gax.rpc.OperationCallable<CreateHubRequest,Hub,OperationMetadata> |
createHubOperationCallable()
Creates a new Network Connectivity Center hub in the specified project.
|
com.google.api.gax.longrunning.OperationFuture<Spoke,OperationMetadata> |
createSpokeAsync(CreateSpokeRequest request)
Creates a Network Connectivity Center spoke.
|
com.google.api.gax.longrunning.OperationFuture<Spoke,OperationMetadata> |
createSpokeAsync(LocationName parent,
Spoke spoke,
String spokeId)
Creates a Network Connectivity Center spoke.
|
com.google.api.gax.longrunning.OperationFuture<Spoke,OperationMetadata> |
createSpokeAsync(String parent,
Spoke spoke,
String spokeId)
Creates a Network Connectivity Center spoke.
|
com.google.api.gax.rpc.UnaryCallable<CreateSpokeRequest,com.google.longrunning.Operation> |
createSpokeCallable()
Creates a Network Connectivity Center spoke.
|
com.google.api.gax.rpc.OperationCallable<CreateSpokeRequest,Spoke,OperationMetadata> |
createSpokeOperationCallable()
Creates a Network Connectivity Center spoke.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteHubAsync(DeleteHubRequest request)
Deletes a Network Connectivity Center hub.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteHubAsync(HubName name)
Deletes a Network Connectivity Center hub.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteHubAsync(String name)
Deletes a Network Connectivity Center hub.
|
com.google.api.gax.rpc.UnaryCallable<DeleteHubRequest,com.google.longrunning.Operation> |
deleteHubCallable()
Deletes a Network Connectivity Center hub.
|
com.google.api.gax.rpc.OperationCallable<DeleteHubRequest,com.google.protobuf.Empty,OperationMetadata> |
deleteHubOperationCallable()
Deletes a Network Connectivity Center hub.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteSpokeAsync(DeleteSpokeRequest request)
Deletes a Network Connectivity Center spoke.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteSpokeAsync(SpokeName name)
Deletes a Network Connectivity Center spoke.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteSpokeAsync(String name)
Deletes a Network Connectivity Center spoke.
|
com.google.api.gax.rpc.UnaryCallable<DeleteSpokeRequest,com.google.longrunning.Operation> |
deleteSpokeCallable()
Deletes a Network Connectivity Center spoke.
|
com.google.api.gax.rpc.OperationCallable<DeleteSpokeRequest,com.google.protobuf.Empty,OperationMetadata> |
deleteSpokeOperationCallable()
Deletes a Network Connectivity Center spoke.
|
Hub |
getHub(GetHubRequest request)
Gets details about a Network Connectivity Center hub.
|
Hub |
getHub(HubName name)
Gets details about a Network Connectivity Center hub.
|
Hub |
getHub(String name)
Gets details about a Network Connectivity Center hub.
|
com.google.api.gax.rpc.UnaryCallable<GetHubRequest,Hub> |
getHubCallable()
Gets details about a Network Connectivity Center hub.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
HubServiceSettings |
getSettings() |
Spoke |
getSpoke(GetSpokeRequest request)
Gets details about a Network Connectivity Center spoke.
|
Spoke |
getSpoke(SpokeName name)
Gets details about a Network Connectivity Center spoke.
|
Spoke |
getSpoke(String name)
Gets details about a Network Connectivity Center spoke.
|
com.google.api.gax.rpc.UnaryCallable<GetSpokeRequest,Spoke> |
getSpokeCallable()
Gets details about a Network Connectivity Center spoke.
|
HubServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
HubServiceClient.ListHubsPagedResponse |
listHubs(ListHubsRequest request)
Lists the Network Connectivity Center hubs associated with a given project.
|
HubServiceClient.ListHubsPagedResponse |
listHubs(LocationName parent)
Lists the Network Connectivity Center hubs associated with a given project.
|
HubServiceClient.ListHubsPagedResponse |
listHubs(String parent)
Lists the Network Connectivity Center hubs associated with a given project.
|
com.google.api.gax.rpc.UnaryCallable<ListHubsRequest,ListHubsResponse> |
listHubsCallable()
Lists the Network Connectivity Center hubs associated with a given project.
|
com.google.api.gax.rpc.UnaryCallable<ListHubsRequest,HubServiceClient.ListHubsPagedResponse> |
listHubsPagedCallable()
Lists the Network Connectivity Center hubs associated with a given project.
|
HubServiceClient.ListSpokesPagedResponse |
listSpokes(ListSpokesRequest request)
Lists the Network Connectivity Center spokes in a specified project and location.
|
HubServiceClient.ListSpokesPagedResponse |
listSpokes(LocationName parent)
Lists the Network Connectivity Center spokes in a specified project and location.
|
HubServiceClient.ListSpokesPagedResponse |
listSpokes(String parent)
Lists the Network Connectivity Center spokes in a specified project and location.
|
com.google.api.gax.rpc.UnaryCallable<ListSpokesRequest,ListSpokesResponse> |
listSpokesCallable()
Lists the Network Connectivity Center spokes in a specified project and location.
|
com.google.api.gax.rpc.UnaryCallable<ListSpokesRequest,HubServiceClient.ListSpokesPagedResponse> |
listSpokesPagedCallable()
Lists the Network Connectivity Center spokes in a specified project and location.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.api.gax.longrunning.OperationFuture<Hub,OperationMetadata> |
updateHubAsync(Hub hub,
com.google.protobuf.FieldMask updateMask)
Updates the description and/or labels of a Network Connectivity Center hub.
|
com.google.api.gax.longrunning.OperationFuture<Hub,OperationMetadata> |
updateHubAsync(UpdateHubRequest request)
Updates the description and/or labels of a Network Connectivity Center hub.
|
com.google.api.gax.rpc.UnaryCallable<UpdateHubRequest,com.google.longrunning.Operation> |
updateHubCallable()
Updates the description and/or labels of a Network Connectivity Center hub.
|
com.google.api.gax.rpc.OperationCallable<UpdateHubRequest,Hub,OperationMetadata> |
updateHubOperationCallable()
Updates the description and/or labels of a Network Connectivity Center hub.
|
com.google.api.gax.longrunning.OperationFuture<Spoke,OperationMetadata> |
updateSpokeAsync(Spoke spoke,
com.google.protobuf.FieldMask updateMask)
Updates the parameters of a Network Connectivity Center spoke.
|
com.google.api.gax.longrunning.OperationFuture<Spoke,OperationMetadata> |
updateSpokeAsync(UpdateSpokeRequest request)
Updates the parameters of a Network Connectivity Center spoke.
|
com.google.api.gax.rpc.UnaryCallable<UpdateSpokeRequest,com.google.longrunning.Operation> |
updateSpokeCallable()
Updates the parameters of a Network Connectivity Center spoke.
|
com.google.api.gax.rpc.OperationCallable<UpdateSpokeRequest,Spoke,OperationMetadata> |
updateSpokeOperationCallable()
Updates the parameters of a Network Connectivity Center spoke.
|
protected HubServiceClient(HubServiceSettings settings) throws IOException
IOExceptionprotected HubServiceClient(HubServiceStub stub)
public static final HubServiceClient create() throws IOException
IOExceptionpublic static final HubServiceClient create(HubServiceSettings settings) throws IOException
IOExceptionpublic static final HubServiceClient create(HubServiceStub stub)
public final HubServiceSettings getSettings()
public HubServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
public final HubServiceClient.ListHubsPagedResponse listHubs(LocationName parent)
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);
}
}
parent - Required. The parent resource's name.com.google.api.gax.rpc.ApiException - if the remote call failspublic final HubServiceClient.ListHubsPagedResponse listHubs(String parent)
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);
}
}
parent - Required. The parent resource's name.com.google.api.gax.rpc.ApiException - if the remote call failspublic final HubServiceClient.ListHubsPagedResponse listHubs(ListHubsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListHubsRequest,HubServiceClient.ListHubsPagedResponse> listHubsPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListHubsRequest,ListHubsResponse> listHubsCallable()
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;
}
}
}
public final Hub getHub(HubName name)
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);
}
name - Required. The name of the hub resource to get.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Hub getHub(String name)
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);
}
name - Required. The name of the hub resource to get.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Hub getHub(GetHubRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (HubServiceClient hubServiceClient = HubServiceClient.create()) {
GetHubRequest request =
GetHubRequest.newBuilder().setName(HubName.of("[PROJECT]", "[HUB]").toString()).build();
Hub response = hubServiceClient.getHub(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetHubRequest,Hub> getHubCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Hub,OperationMetadata> createHubAsync(LocationName parent, Hub hub, String hubId)
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();
}
parent - Required. The parent resource.hub - Required. The initial values for a new hub.hubId - Required. A unique identifier for the hub.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Hub,OperationMetadata> createHubAsync(String parent, Hub hub, String hubId)
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();
}
parent - Required. The parent resource.hub - Required. The initial values for a new hub.hubId - Required. A unique identifier for the hub.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Hub,OperationMetadata> createHubAsync(CreateHubRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateHubRequest,Hub,OperationMetadata> createHubOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateHubRequest,com.google.longrunning.Operation> createHubCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Hub,OperationMetadata> updateHubAsync(Hub hub, com.google.protobuf.FieldMask updateMask)
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();
}
hub - Required. The state that the hub should be in after the update.updateMask - Optional. In the case of an update to an existing hub, field mask is used to
specify the fields to be overwritten. The fields specified in the update_mask are relative
to the resource, not the full request. A field is overwritten if it is in the mask. If the
user does not provide a mask, then all fields are overwritten.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Hub,OperationMetadata> updateHubAsync(UpdateHubRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateHubRequest,Hub,OperationMetadata> updateHubOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateHubRequest,com.google.longrunning.Operation> updateHubCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteHubAsync(HubName name)
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();
}
name - Required. The name of the hub to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteHubAsync(String name)
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();
}
name - Required. The name of the hub to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteHubAsync(DeleteHubRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (HubServiceClient hubServiceClient = HubServiceClient.create()) {
DeleteHubRequest request =
DeleteHubRequest.newBuilder()
.setName(HubName.of("[PROJECT]", "[HUB]").toString())
.setRequestId("requestId693933066")
.build();
hubServiceClient.deleteHubAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteHubRequest,com.google.protobuf.Empty,OperationMetadata> deleteHubOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteHubRequest,com.google.longrunning.Operation> deleteHubCallable()
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();
}
public final HubServiceClient.ListSpokesPagedResponse listSpokes(LocationName parent)
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);
}
}
parent - Required. The parent resource.com.google.api.gax.rpc.ApiException - if the remote call failspublic final HubServiceClient.ListSpokesPagedResponse listSpokes(String parent)
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);
}
}
parent - Required. The parent resource.com.google.api.gax.rpc.ApiException - if the remote call failspublic final HubServiceClient.ListSpokesPagedResponse listSpokes(ListSpokesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListSpokesRequest,HubServiceClient.ListSpokesPagedResponse> listSpokesPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListSpokesRequest,ListSpokesResponse> listSpokesCallable()
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;
}
}
}
public final Spoke getSpoke(SpokeName name)
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);
}
name - Required. The name of the spoke resource.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Spoke getSpoke(String name)
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);
}
name - Required. The name of the spoke resource.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Spoke getSpoke(GetSpokeRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (HubServiceClient hubServiceClient = HubServiceClient.create()) {
GetSpokeRequest request =
GetSpokeRequest.newBuilder()
.setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString())
.build();
Spoke response = hubServiceClient.getSpoke(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetSpokeRequest,Spoke> getSpokeCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Spoke,OperationMetadata> createSpokeAsync(LocationName parent, Spoke spoke, String spokeId)
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();
}
parent - Required. The parent resource.spoke - Required. The initial values for a new spoke.spokeId - Required. Unique id for the spoke to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Spoke,OperationMetadata> createSpokeAsync(String parent, Spoke spoke, String spokeId)
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();
}
parent - Required. The parent resource.spoke - Required. The initial values for a new spoke.spokeId - Required. Unique id for the spoke to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Spoke,OperationMetadata> createSpokeAsync(CreateSpokeRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateSpokeRequest,Spoke,OperationMetadata> createSpokeOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateSpokeRequest,com.google.longrunning.Operation> createSpokeCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<Spoke,OperationMetadata> updateSpokeAsync(Spoke spoke, com.google.protobuf.FieldMask updateMask)
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();
}
spoke - Required. The state that the spoke should be in after the update.updateMask - Optional. In the case of an update to an existing spoke, field mask is used
to specify the fields to be overwritten. The fields specified in the update_mask are
relative to the resource, not the full request. A field is overwritten if it is in the
mask. If the user does not provide a mask, then all fields are overwritten.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Spoke,OperationMetadata> updateSpokeAsync(UpdateSpokeRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateSpokeRequest,Spoke,OperationMetadata> updateSpokeOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateSpokeRequest,com.google.longrunning.Operation> updateSpokeCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteSpokeAsync(SpokeName name)
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();
}
name - Required. The name of the spoke to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteSpokeAsync(String name)
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();
}
name - Required. The name of the spoke to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteSpokeAsync(DeleteSpokeRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (HubServiceClient hubServiceClient = HubServiceClient.create()) {
DeleteSpokeRequest request =
DeleteSpokeRequest.newBuilder()
.setName(SpokeName.of("[PROJECT]", "[LOCATION]", "[SPOKE]").toString())
.setRequestId("requestId693933066")
.build();
hubServiceClient.deleteSpokeAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteSpokeRequest,com.google.protobuf.Empty,OperationMetadata> deleteSpokeOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteSpokeRequest,com.google.longrunning.Operation> deleteSpokeCallable()
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();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2023 Google LLC. All rights reserved.