com.google.cloud.networkconnectivity.v1alpha1.HubServiceClient Maven / Gradle / Ivy
Show all versions of google-cloud-networkconnectivity Show documentation
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.networkconnectivity.v1alpha1;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.networkconnectivity.v1alpha1.stub.HubServiceStub;
import com.google.cloud.networkconnectivity.v1alpha1.stub.HubServiceStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
import com.google.longrunning.OperationsClient;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: Network Connectivity Center is a hub-and-spoke abstraction for network
* connectivity management in Google Cloud. It reduces operational complexity through a simple,
* centralized connectivity management model.
*
* 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:
*
*
{@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);
* }
* }
*
* 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().
*
*
* Methods
*
* 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.
*
* listHubs(ListHubsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listHubs(LocationName parent)
*
listHubs(String parent)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listHubsPagedCallable()
*
listHubsCallable()
*
*
*
*
* 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.
*
* getHub(GetHubRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getHub(HubName name)
*
getHub(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getHubCallable()
*
*
*
*
* 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.
*
* createHubAsync(CreateHubRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* createHubAsync(LocationName parent, Hub hub, String hubId)
*
createHubAsync(String parent, Hub hub, String hubId)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* createHubOperationCallable()
*
createHubCallable()
*
*
*
*
* 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.
*
* updateHubAsync(UpdateHubRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* updateHubAsync(Hub hub, FieldMask updateMask)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* updateHubOperationCallable()
*
updateHubCallable()
*
*
*
*
* DeleteHub
* Deletes a single Hub.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* deleteHubAsync(DeleteHubRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* deleteHubAsync(HubName name)
*
deleteHubAsync(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* deleteHubOperationCallable()
*
deleteHubCallable()
*
*
*
*
* 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.
*
* listSpokes(ListSpokesRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listSpokes(LocationName parent)
*
listSpokes(String parent)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listSpokesPagedCallable()
*
listSpokesCallable()
*
*
*
*
* 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.
*
* getSpoke(GetSpokeRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getSpoke(SpokeName name)
*
getSpoke(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getSpokeCallable()
*
*
*
*
* 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.
*
* createSpokeAsync(CreateSpokeRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* createSpokeAsync(LocationName parent, Spoke spoke, String spokeId)
*
createSpokeAsync(String parent, Spoke spoke, String spokeId)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* createSpokeOperationCallable()
*
createSpokeCallable()
*
*
*
*
* 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.
*
* updateSpokeAsync(UpdateSpokeRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* updateSpokeAsync(Spoke spoke, FieldMask updateMask)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* updateSpokeOperationCallable()
*
updateSpokeCallable()
*
*
*
*
* DeleteSpoke
* Deletes a single Spoke.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* deleteSpokeAsync(DeleteSpokeRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* deleteSpokeAsync(SpokeName name)
*
deleteSpokeAsync(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* deleteSpokeOperationCallable()
*
deleteSpokeCallable()
*
*
*
*
*
* 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:
*
*
{@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
* HubServiceSettings hubServiceSettings =
* HubServiceSettings.newBuilder()
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();
* HubServiceClient hubServiceClient = HubServiceClient.create(hubServiceSettings);
* }
*
* To customize the endpoint:
*
*
{@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
* 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.
*/
@BetaApi
@Generated("by gapic-generator-java")
public class HubServiceClient implements BackgroundResource {
private final HubServiceSettings settings;
private final HubServiceStub stub;
private final OperationsClient operationsClient;
/** Constructs an instance of HubServiceClient with default settings. */
public static final HubServiceClient create() throws IOException {
return create(HubServiceSettings.newBuilder().build());
}
/**
* 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.
*/
public static final HubServiceClient create(HubServiceSettings settings) throws IOException {
return new HubServiceClient(settings);
}
/**
* Constructs an instance of HubServiceClient, using the given stub for making calls. This is for
* advanced usage - prefer using create(HubServiceSettings).
*/
public static final HubServiceClient create(HubServiceStub stub) {
return new HubServiceClient(stub);
}
/**
* 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.
*/
protected HubServiceClient(HubServiceSettings settings) throws IOException {
this.settings = settings;
this.stub = ((HubServiceStubSettings) settings.getStubSettings()).createStub();
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
}
protected HubServiceClient(HubServiceStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
}
public final HubServiceSettings getSettings() {
return settings;
}
public HubServiceStub getStub() {
return stub;
}
/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
public final OperationsClient getOperationsClient() {
return operationsClient;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Hubs in a given project and location.
*
*
Sample code:
*
*
{@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);
* }
* }
* }
*
* @param parent Required. The parent resource's name.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListHubsPagedResponse listHubs(LocationName parent) {
ListHubsRequest request =
ListHubsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
return listHubs(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Hubs in a given project and location.
*
* Sample code:
*
*
{@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);
* }
* }
* }
*
* @param parent Required. The parent resource's name.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListHubsPagedResponse listHubs(String parent) {
ListHubsRequest request = ListHubsRequest.newBuilder().setParent(parent).build();
return listHubs(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Hubs in a given project and location.
*
* Sample code:
*
*
{@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);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListHubsPagedResponse listHubs(ListHubsRequest request) {
return listHubsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Hubs in a given project and location.
*
* Sample code:
*
*
{@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 future = hubServiceClient.listHubsPagedCallable().futureCall(request);
* // Do something.
* for (Hub element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable listHubsPagedCallable() {
return stub.listHubsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Hubs in a given project and location.
*
* Sample code:
*
*
{@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 UnaryCallable listHubsCallable() {
return stub.listHubsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single Hub.
*
* Sample code:
*
*
{@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);
* }
* }
*
* @param name Required. Name of the Hub resource to get.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Hub getHub(HubName name) {
GetHubRequest request =
GetHubRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getHub(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single Hub.
*
* Sample code:
*
*
{@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);
* }
* }
*
* @param name Required. Name of the Hub resource to get.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Hub getHub(String name) {
GetHubRequest request = GetHubRequest.newBuilder().setName(name).build();
return getHub(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single Hub.
*
* Sample code:
*
*
{@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);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Hub getHub(GetHubRequest request) {
return getHubCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single Hub.
*
* Sample code:
*
*
{@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 future = hubServiceClient.getHubCallable().futureCall(request);
* // Do something.
* Hub response = future.get();
* }
* }
*/
public final UnaryCallable getHubCallable() {
return stub.getHubCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new Hub in a given project and location.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param parent Required. The parent resource's name of the Hub.
* @param hub Required. Initial values for a new Hub.
* @param hubId Optional. Unique id for the Hub to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createHubAsync(
LocationName parent, Hub hub, String hubId) {
CreateHubRequest request =
CreateHubRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setHub(hub)
.setHubId(hubId)
.build();
return createHubAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new Hub in a given project and location.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param parent Required. The parent resource's name of the Hub.
* @param hub Required. Initial values for a new Hub.
* @param hubId Optional. Unique id for the Hub to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createHubAsync(
String parent, Hub hub, String hubId) {
CreateHubRequest request =
CreateHubRequest.newBuilder().setParent(parent).setHub(hub).setHubId(hubId).build();
return createHubAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new Hub in a given project and location.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createHubAsync(CreateHubRequest request) {
return createHubOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new Hub in a given project and location.
*
* Sample code:
*
*
{@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 future =
* hubServiceClient.createHubOperationCallable().futureCall(request);
* // Do something.
* Hub response = future.get();
* }
* }
*/
public final OperationCallable
createHubOperationCallable() {
return stub.createHubOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new Hub in a given project and location.
*
* Sample code:
*
*
{@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 future = hubServiceClient.createHubCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable createHubCallable() {
return stub.createHubCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the parameters of a single Hub.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param hub Required. The state that the Hub should be in after the update.
* @param 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 com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updateHubAsync(
Hub hub, FieldMask updateMask) {
UpdateHubRequest request =
UpdateHubRequest.newBuilder().setHub(hub).setUpdateMask(updateMask).build();
return updateHubAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the parameters of a single Hub.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updateHubAsync(UpdateHubRequest request) {
return updateHubOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the parameters of a single Hub.
*
* Sample code:
*
*
{@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 future =
* hubServiceClient.updateHubOperationCallable().futureCall(request);
* // Do something.
* Hub response = future.get();
* }
* }
*/
public final OperationCallable
updateHubOperationCallable() {
return stub.updateHubOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the parameters of a single Hub.
*
* Sample code:
*
*
{@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 future = hubServiceClient.updateHubCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable updateHubCallable() {
return stub.updateHubCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single Hub.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param name Required. The name of the Hub to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteHubAsync(HubName name) {
DeleteHubRequest request =
DeleteHubRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return deleteHubAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single Hub.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param name Required. The name of the Hub to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteHubAsync(String name) {
DeleteHubRequest request = DeleteHubRequest.newBuilder().setName(name).build();
return deleteHubAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single Hub.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteHubAsync(DeleteHubRequest request) {
return deleteHubOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single Hub.
*
* Sample code:
*
*
{@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 future =
* hubServiceClient.deleteHubOperationCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final OperationCallable
deleteHubOperationCallable() {
return stub.deleteHubOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single Hub.
*
* Sample code:
*
*
{@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 future = hubServiceClient.deleteHubCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable deleteHubCallable() {
return stub.deleteHubCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Spokes in a given project and location.
*
* Sample code:
*
*
{@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);
* }
* }
* }
*
* @param parent Required. The parent's resource name.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListSpokesPagedResponse listSpokes(LocationName parent) {
ListSpokesRequest request =
ListSpokesRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
return listSpokes(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Spokes in a given project and location.
*
* Sample code:
*
*
{@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);
* }
* }
* }
*
* @param parent Required. The parent's resource name.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListSpokesPagedResponse listSpokes(String parent) {
ListSpokesRequest request = ListSpokesRequest.newBuilder().setParent(parent).build();
return listSpokes(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Spokes in a given project and location.
*
* Sample code:
*
*
{@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);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListSpokesPagedResponse listSpokes(ListSpokesRequest request) {
return listSpokesPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Spokes in a given project and location.
*
* Sample code:
*
*
{@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 future = hubServiceClient.listSpokesPagedCallable().futureCall(request);
* // Do something.
* for (Spoke element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable listSpokesPagedCallable() {
return stub.listSpokesPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Spokes in a given project and location.
*
* Sample code:
*
*
{@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 UnaryCallable listSpokesCallable() {
return stub.listSpokesCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single Spoke.
*
* Sample code:
*
*
{@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);
* }
* }
*
* @param name Required. The name of Spoke resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Spoke getSpoke(SpokeName name) {
GetSpokeRequest request =
GetSpokeRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getSpoke(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single Spoke.
*
* Sample code:
*
*
{@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);
* }
* }
*
* @param name Required. The name of Spoke resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Spoke getSpoke(String name) {
GetSpokeRequest request = GetSpokeRequest.newBuilder().setName(name).build();
return getSpoke(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single Spoke.
*
* Sample code:
*
*
{@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);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Spoke getSpoke(GetSpokeRequest request) {
return getSpokeCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single Spoke.
*
* Sample code:
*
*
{@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 future = hubServiceClient.getSpokeCallable().futureCall(request);
* // Do something.
* Spoke response = future.get();
* }
* }
*/
public final UnaryCallable getSpokeCallable() {
return stub.getSpokeCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new Spoke in a given project and location.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param parent Required. The parent's resource name of the Spoke.
* @param spoke Required. Initial values for a new Hub.
* @param spokeId Optional. Unique id for the Spoke to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createSpokeAsync(
LocationName parent, Spoke spoke, String spokeId) {
CreateSpokeRequest request =
CreateSpokeRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setSpoke(spoke)
.setSpokeId(spokeId)
.build();
return createSpokeAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new Spoke in a given project and location.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param parent Required. The parent's resource name of the Spoke.
* @param spoke Required. Initial values for a new Hub.
* @param spokeId Optional. Unique id for the Spoke to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createSpokeAsync(
String parent, Spoke spoke, String spokeId) {
CreateSpokeRequest request =
CreateSpokeRequest.newBuilder()
.setParent(parent)
.setSpoke(spoke)
.setSpokeId(spokeId)
.build();
return createSpokeAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new Spoke in a given project and location.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createSpokeAsync(
CreateSpokeRequest request) {
return createSpokeOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new Spoke in a given project and location.
*
* Sample code:
*
*
{@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 future =
* hubServiceClient.createSpokeOperationCallable().futureCall(request);
* // Do something.
* Spoke response = future.get();
* }
* }
*/
public final OperationCallable
createSpokeOperationCallable() {
return stub.createSpokeOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new Spoke in a given project and location.
*
* Sample code:
*
*
{@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 future = hubServiceClient.createSpokeCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable createSpokeCallable() {
return stub.createSpokeCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the parameters of a single Spoke.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param spoke Required. The state that the Spoke should be in after the update.
* @param 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 com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updateSpokeAsync(
Spoke spoke, FieldMask updateMask) {
UpdateSpokeRequest request =
UpdateSpokeRequest.newBuilder().setSpoke(spoke).setUpdateMask(updateMask).build();
return updateSpokeAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the parameters of a single Spoke.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updateSpokeAsync(
UpdateSpokeRequest request) {
return updateSpokeOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the parameters of a single Spoke.
*
* Sample code:
*
*
{@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 future =
* hubServiceClient.updateSpokeOperationCallable().futureCall(request);
* // Do something.
* Spoke response = future.get();
* }
* }
*/
public final OperationCallable
updateSpokeOperationCallable() {
return stub.updateSpokeOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the parameters of a single Spoke.
*
* Sample code:
*
*
{@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 future = hubServiceClient.updateSpokeCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable updateSpokeCallable() {
return stub.updateSpokeCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single Spoke.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param name Required. The name of the Spoke to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteSpokeAsync(SpokeName name) {
DeleteSpokeRequest request =
DeleteSpokeRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return deleteSpokeAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single Spoke.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param name Required. The name of the Spoke to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteSpokeAsync(String name) {
DeleteSpokeRequest request = DeleteSpokeRequest.newBuilder().setName(name).build();
return deleteSpokeAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single Spoke.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteSpokeAsync(
DeleteSpokeRequest request) {
return deleteSpokeOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single Spoke.
*
* Sample code:
*
*
{@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 future =
* hubServiceClient.deleteSpokeOperationCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final OperationCallable
deleteSpokeOperationCallable() {
return stub.deleteSpokeOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single Spoke.
*
* Sample code:
*
*
{@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 future = hubServiceClient.deleteSpokeCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable deleteSpokeCallable() {
return stub.deleteSpokeCallable();
}
@Override
public final void close() {
stub.close();
}
@Override
public void shutdown() {
stub.shutdown();
}
@Override
public boolean isShutdown() {
return stub.isShutdown();
}
@Override
public boolean isTerminated() {
return stub.isTerminated();
}
@Override
public void shutdownNow() {
stub.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return stub.awaitTermination(duration, unit);
}
public static class ListHubsPagedResponse
extends AbstractPagedListResponse<
ListHubsRequest, ListHubsResponse, Hub, ListHubsPage, ListHubsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListHubsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage, input -> new ListHubsPagedResponse(input), MoreExecutors.directExecutor());
}
private ListHubsPagedResponse(ListHubsPage page) {
super(page, ListHubsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListHubsPage
extends AbstractPage {
private ListHubsPage(
PageContext context, ListHubsResponse response) {
super(context, response);
}
private static ListHubsPage createEmptyPage() {
return new ListHubsPage(null, null);
}
@Override
protected ListHubsPage createPage(
PageContext context, ListHubsResponse response) {
return new ListHubsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListHubsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListHubsRequest, ListHubsResponse, Hub, ListHubsPage, ListHubsFixedSizeCollection> {
private ListHubsFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListHubsFixedSizeCollection createEmptyCollection() {
return new ListHubsFixedSizeCollection(null, 0);
}
@Override
protected ListHubsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListHubsFixedSizeCollection(pages, collectionSize);
}
}
public static class ListSpokesPagedResponse
extends AbstractPagedListResponse<
ListSpokesRequest,
ListSpokesResponse,
Spoke,
ListSpokesPage,
ListSpokesFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListSpokesPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage, input -> new ListSpokesPagedResponse(input), MoreExecutors.directExecutor());
}
private ListSpokesPagedResponse(ListSpokesPage page) {
super(page, ListSpokesFixedSizeCollection.createEmptyCollection());
}
}
public static class ListSpokesPage
extends AbstractPage {
private ListSpokesPage(
PageContext context,
ListSpokesResponse response) {
super(context, response);
}
private static ListSpokesPage createEmptyPage() {
return new ListSpokesPage(null, null);
}
@Override
protected ListSpokesPage createPage(
PageContext context,
ListSpokesResponse response) {
return new ListSpokesPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListSpokesFixedSizeCollection
extends AbstractFixedSizeCollection<
ListSpokesRequest,
ListSpokesResponse,
Spoke,
ListSpokesPage,
ListSpokesFixedSizeCollection> {
private ListSpokesFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListSpokesFixedSizeCollection createEmptyCollection() {
return new ListSpokesFixedSizeCollection(null, 0);
}
@Override
protected ListSpokesFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListSpokesFixedSizeCollection(pages, collectionSize);
}
}
}