com.google.cloud.networkconnectivity.v1.stub.GrpcHubServiceStub 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.v1.stub;
import static com.google.cloud.networkconnectivity.v1.HubServiceClient.ListGroupsPagedResponse;
import static com.google.cloud.networkconnectivity.v1.HubServiceClient.ListHubSpokesPagedResponse;
import static com.google.cloud.networkconnectivity.v1.HubServiceClient.ListHubsPagedResponse;
import static com.google.cloud.networkconnectivity.v1.HubServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.networkconnectivity.v1.HubServiceClient.ListRouteTablesPagedResponse;
import static com.google.cloud.networkconnectivity.v1.HubServiceClient.ListRoutesPagedResponse;
import static com.google.cloud.networkconnectivity.v1.HubServiceClient.ListSpokesPagedResponse;
import static com.google.cloud.networkconnectivity.v1.HubServiceClient.QueryHubStatusPagedResponse;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.grpc.GrpcCallSettings;
import com.google.api.gax.grpc.GrpcStubCallableFactory;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.cloud.networkconnectivity.v1.AcceptHubSpokeRequest;
import com.google.cloud.networkconnectivity.v1.AcceptHubSpokeResponse;
import com.google.cloud.networkconnectivity.v1.CreateHubRequest;
import com.google.cloud.networkconnectivity.v1.CreateSpokeRequest;
import com.google.cloud.networkconnectivity.v1.DeleteHubRequest;
import com.google.cloud.networkconnectivity.v1.DeleteSpokeRequest;
import com.google.cloud.networkconnectivity.v1.GetGroupRequest;
import com.google.cloud.networkconnectivity.v1.GetHubRequest;
import com.google.cloud.networkconnectivity.v1.GetRouteRequest;
import com.google.cloud.networkconnectivity.v1.GetRouteTableRequest;
import com.google.cloud.networkconnectivity.v1.GetSpokeRequest;
import com.google.cloud.networkconnectivity.v1.Group;
import com.google.cloud.networkconnectivity.v1.Hub;
import com.google.cloud.networkconnectivity.v1.ListGroupsRequest;
import com.google.cloud.networkconnectivity.v1.ListGroupsResponse;
import com.google.cloud.networkconnectivity.v1.ListHubSpokesRequest;
import com.google.cloud.networkconnectivity.v1.ListHubSpokesResponse;
import com.google.cloud.networkconnectivity.v1.ListHubsRequest;
import com.google.cloud.networkconnectivity.v1.ListHubsResponse;
import com.google.cloud.networkconnectivity.v1.ListRouteTablesRequest;
import com.google.cloud.networkconnectivity.v1.ListRouteTablesResponse;
import com.google.cloud.networkconnectivity.v1.ListRoutesRequest;
import com.google.cloud.networkconnectivity.v1.ListRoutesResponse;
import com.google.cloud.networkconnectivity.v1.ListSpokesRequest;
import com.google.cloud.networkconnectivity.v1.ListSpokesResponse;
import com.google.cloud.networkconnectivity.v1.OperationMetadata;
import com.google.cloud.networkconnectivity.v1.QueryHubStatusRequest;
import com.google.cloud.networkconnectivity.v1.QueryHubStatusResponse;
import com.google.cloud.networkconnectivity.v1.RejectHubSpokeRequest;
import com.google.cloud.networkconnectivity.v1.RejectHubSpokeResponse;
import com.google.cloud.networkconnectivity.v1.Route;
import com.google.cloud.networkconnectivity.v1.RouteTable;
import com.google.cloud.networkconnectivity.v1.Spoke;
import com.google.cloud.networkconnectivity.v1.UpdateGroupRequest;
import com.google.cloud.networkconnectivity.v1.UpdateHubRequest;
import com.google.cloud.networkconnectivity.v1.UpdateSpokeRequest;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.longrunning.stub.GrpcOperationsStub;
import com.google.protobuf.Empty;
import io.grpc.MethodDescriptor;
import io.grpc.protobuf.ProtoUtils;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* gRPC stub implementation for the HubService service API.
*
* This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator-java")
public class GrpcHubServiceStub extends HubServiceStub {
private static final MethodDescriptor
listHubsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/ListHubs")
.setRequestMarshaller(ProtoUtils.marshaller(ListHubsRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(ListHubsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor getHubMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/GetHub")
.setRequestMarshaller(ProtoUtils.marshaller(GetHubRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Hub.getDefaultInstance()))
.build();
private static final MethodDescriptor createHubMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/CreateHub")
.setRequestMarshaller(ProtoUtils.marshaller(CreateHubRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor updateHubMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/UpdateHub")
.setRequestMarshaller(ProtoUtils.marshaller(UpdateHubRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor deleteHubMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/DeleteHub")
.setRequestMarshaller(ProtoUtils.marshaller(DeleteHubRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
listHubSpokesMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/ListHubSpokes")
.setRequestMarshaller(
ProtoUtils.marshaller(ListHubSpokesRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListHubSpokesResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
queryHubStatusMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/QueryHubStatus")
.setRequestMarshaller(
ProtoUtils.marshaller(QueryHubStatusRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(QueryHubStatusResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
listSpokesMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/ListSpokes")
.setRequestMarshaller(ProtoUtils.marshaller(ListSpokesRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(ListSpokesResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor getSpokeMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/GetSpoke")
.setRequestMarshaller(ProtoUtils.marshaller(GetSpokeRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Spoke.getDefaultInstance()))
.build();
private static final MethodDescriptor createSpokeMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/CreateSpoke")
.setRequestMarshaller(ProtoUtils.marshaller(CreateSpokeRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor updateSpokeMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/UpdateSpoke")
.setRequestMarshaller(ProtoUtils.marshaller(UpdateSpokeRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
rejectHubSpokeMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/RejectHubSpoke")
.setRequestMarshaller(
ProtoUtils.marshaller(RejectHubSpokeRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
acceptHubSpokeMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/AcceptHubSpoke")
.setRequestMarshaller(
ProtoUtils.marshaller(AcceptHubSpokeRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor deleteSpokeMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/DeleteSpoke")
.setRequestMarshaller(ProtoUtils.marshaller(DeleteSpokeRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
getRouteTableMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/GetRouteTable")
.setRequestMarshaller(
ProtoUtils.marshaller(GetRouteTableRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(RouteTable.getDefaultInstance()))
.build();
private static final MethodDescriptor getRouteMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/GetRoute")
.setRequestMarshaller(ProtoUtils.marshaller(GetRouteRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Route.getDefaultInstance()))
.build();
private static final MethodDescriptor
listRoutesMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/ListRoutes")
.setRequestMarshaller(ProtoUtils.marshaller(ListRoutesRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(ListRoutesResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
listRouteTablesMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/ListRouteTables")
.setRequestMarshaller(
ProtoUtils.marshaller(ListRouteTablesRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListRouteTablesResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor getGroupMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/GetGroup")
.setRequestMarshaller(ProtoUtils.marshaller(GetGroupRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Group.getDefaultInstance()))
.build();
private static final MethodDescriptor
listGroupsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/ListGroups")
.setRequestMarshaller(ProtoUtils.marshaller(ListGroupsRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(ListGroupsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor updateGroupMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.networkconnectivity.v1.HubService/UpdateGroup")
.setRequestMarshaller(ProtoUtils.marshaller(UpdateGroupRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
listLocationsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.location.Locations/ListLocations")
.setRequestMarshaller(
ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor getLocationMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.location.Locations/GetLocation")
.setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance()))
.build();
private static final MethodDescriptor setIamPolicyMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy")
.setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance()))
.build();
private static final MethodDescriptor getIamPolicyMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy")
.setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance()))
.build();
private static final MethodDescriptor
testIamPermissionsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.iam.v1.IAMPolicy/TestIamPermissions")
.setRequestMarshaller(
ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance()))
.build();
private final UnaryCallable listHubsCallable;
private final UnaryCallable listHubsPagedCallable;
private final UnaryCallable getHubCallable;
private final UnaryCallable createHubCallable;
private final OperationCallable
createHubOperationCallable;
private final UnaryCallable updateHubCallable;
private final OperationCallable
updateHubOperationCallable;
private final UnaryCallable deleteHubCallable;
private final OperationCallable
deleteHubOperationCallable;
private final UnaryCallable listHubSpokesCallable;
private final UnaryCallable
listHubSpokesPagedCallable;
private final UnaryCallable queryHubStatusCallable;
private final UnaryCallable
queryHubStatusPagedCallable;
private final UnaryCallable listSpokesCallable;
private final UnaryCallable listSpokesPagedCallable;
private final UnaryCallable getSpokeCallable;
private final UnaryCallable createSpokeCallable;
private final OperationCallable
createSpokeOperationCallable;
private final UnaryCallable updateSpokeCallable;
private final OperationCallable
updateSpokeOperationCallable;
private final UnaryCallable rejectHubSpokeCallable;
private final OperationCallable
rejectHubSpokeOperationCallable;
private final UnaryCallable acceptHubSpokeCallable;
private final OperationCallable
acceptHubSpokeOperationCallable;
private final UnaryCallable deleteSpokeCallable;
private final OperationCallable
deleteSpokeOperationCallable;
private final UnaryCallable getRouteTableCallable;
private final UnaryCallable getRouteCallable;
private final UnaryCallable listRoutesCallable;
private final UnaryCallable listRoutesPagedCallable;
private final UnaryCallable
listRouteTablesCallable;
private final UnaryCallable
listRouteTablesPagedCallable;
private final UnaryCallable getGroupCallable;
private final UnaryCallable listGroupsCallable;
private final UnaryCallable listGroupsPagedCallable;
private final UnaryCallable updateGroupCallable;
private final OperationCallable
updateGroupOperationCallable;
private final UnaryCallable listLocationsCallable;
private final UnaryCallable
listLocationsPagedCallable;
private final UnaryCallable getLocationCallable;
private final UnaryCallable setIamPolicyCallable;
private final UnaryCallable getIamPolicyCallable;
private final UnaryCallable
testIamPermissionsCallable;
private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
private final GrpcStubCallableFactory callableFactory;
public static final GrpcHubServiceStub create(HubServiceStubSettings settings)
throws IOException {
return new GrpcHubServiceStub(settings, ClientContext.create(settings));
}
public static final GrpcHubServiceStub create(ClientContext clientContext) throws IOException {
return new GrpcHubServiceStub(HubServiceStubSettings.newBuilder().build(), clientContext);
}
public static final GrpcHubServiceStub create(
ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
return new GrpcHubServiceStub(
HubServiceStubSettings.newBuilder().build(), clientContext, callableFactory);
}
/**
* Constructs an instance of GrpcHubServiceStub, 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 GrpcHubServiceStub(HubServiceStubSettings settings, ClientContext clientContext)
throws IOException {
this(settings, clientContext, new GrpcHubServiceCallableFactory());
}
/**
* Constructs an instance of GrpcHubServiceStub, 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 GrpcHubServiceStub(
HubServiceStubSettings settings,
ClientContext clientContext,
GrpcStubCallableFactory callableFactory)
throws IOException {
this.callableFactory = callableFactory;
this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
GrpcCallSettings listHubsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listHubsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings getHubTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getHubMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings createHubTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(createHubMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings updateHubTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateHubMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("hub.name", String.valueOf(request.getHub().getName()));
return builder.build();
})
.build();
GrpcCallSettings deleteHubTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteHubMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings listHubSpokesTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listHubSpokesMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
queryHubStatusTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(queryHubStatusMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings listSpokesTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listSpokesMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings getSpokeTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getSpokeMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings createSpokeTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(createSpokeMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings updateSpokeTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateSpokeMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("spoke.name", String.valueOf(request.getSpoke().getName()));
return builder.build();
})
.build();
GrpcCallSettings rejectHubSpokeTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(rejectHubSpokeMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings acceptHubSpokeTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(acceptHubSpokeMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings deleteSpokeTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteSpokeMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings getRouteTableTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getRouteTableMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings getRouteTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getRouteMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings listRoutesTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listRoutesMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings
listRouteTablesTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listRouteTablesMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings getGroupTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getGroupMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings listGroupsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listGroupsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings updateGroupTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateGroupMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("group.name", String.valueOf(request.getGroup().getName()));
return builder.build();
})
.build();
GrpcCallSettings listLocationsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listLocationsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings getLocationTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getLocationMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings setIamPolicyTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(setIamPolicyMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("resource", String.valueOf(request.getResource()));
return builder.build();
})
.build();
GrpcCallSettings getIamPolicyTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getIamPolicyMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("resource", String.valueOf(request.getResource()));
return builder.build();
})
.build();
GrpcCallSettings
testIamPermissionsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(testIamPermissionsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("resource", String.valueOf(request.getResource()));
return builder.build();
})
.build();
this.listHubsCallable =
callableFactory.createUnaryCallable(
listHubsTransportSettings, settings.listHubsSettings(), clientContext);
this.listHubsPagedCallable =
callableFactory.createPagedCallable(
listHubsTransportSettings, settings.listHubsSettings(), clientContext);
this.getHubCallable =
callableFactory.createUnaryCallable(
getHubTransportSettings, settings.getHubSettings(), clientContext);
this.createHubCallable =
callableFactory.createUnaryCallable(
createHubTransportSettings, settings.createHubSettings(), clientContext);
this.createHubOperationCallable =
callableFactory.createOperationCallable(
createHubTransportSettings,
settings.createHubOperationSettings(),
clientContext,
operationsStub);
this.updateHubCallable =
callableFactory.createUnaryCallable(
updateHubTransportSettings, settings.updateHubSettings(), clientContext);
this.updateHubOperationCallable =
callableFactory.createOperationCallable(
updateHubTransportSettings,
settings.updateHubOperationSettings(),
clientContext,
operationsStub);
this.deleteHubCallable =
callableFactory.createUnaryCallable(
deleteHubTransportSettings, settings.deleteHubSettings(), clientContext);
this.deleteHubOperationCallable =
callableFactory.createOperationCallable(
deleteHubTransportSettings,
settings.deleteHubOperationSettings(),
clientContext,
operationsStub);
this.listHubSpokesCallable =
callableFactory.createUnaryCallable(
listHubSpokesTransportSettings, settings.listHubSpokesSettings(), clientContext);
this.listHubSpokesPagedCallable =
callableFactory.createPagedCallable(
listHubSpokesTransportSettings, settings.listHubSpokesSettings(), clientContext);
this.queryHubStatusCallable =
callableFactory.createUnaryCallable(
queryHubStatusTransportSettings, settings.queryHubStatusSettings(), clientContext);
this.queryHubStatusPagedCallable =
callableFactory.createPagedCallable(
queryHubStatusTransportSettings, settings.queryHubStatusSettings(), clientContext);
this.listSpokesCallable =
callableFactory.createUnaryCallable(
listSpokesTransportSettings, settings.listSpokesSettings(), clientContext);
this.listSpokesPagedCallable =
callableFactory.createPagedCallable(
listSpokesTransportSettings, settings.listSpokesSettings(), clientContext);
this.getSpokeCallable =
callableFactory.createUnaryCallable(
getSpokeTransportSettings, settings.getSpokeSettings(), clientContext);
this.createSpokeCallable =
callableFactory.createUnaryCallable(
createSpokeTransportSettings, settings.createSpokeSettings(), clientContext);
this.createSpokeOperationCallable =
callableFactory.createOperationCallable(
createSpokeTransportSettings,
settings.createSpokeOperationSettings(),
clientContext,
operationsStub);
this.updateSpokeCallable =
callableFactory.createUnaryCallable(
updateSpokeTransportSettings, settings.updateSpokeSettings(), clientContext);
this.updateSpokeOperationCallable =
callableFactory.createOperationCallable(
updateSpokeTransportSettings,
settings.updateSpokeOperationSettings(),
clientContext,
operationsStub);
this.rejectHubSpokeCallable =
callableFactory.createUnaryCallable(
rejectHubSpokeTransportSettings, settings.rejectHubSpokeSettings(), clientContext);
this.rejectHubSpokeOperationCallable =
callableFactory.createOperationCallable(
rejectHubSpokeTransportSettings,
settings.rejectHubSpokeOperationSettings(),
clientContext,
operationsStub);
this.acceptHubSpokeCallable =
callableFactory.createUnaryCallable(
acceptHubSpokeTransportSettings, settings.acceptHubSpokeSettings(), clientContext);
this.acceptHubSpokeOperationCallable =
callableFactory.createOperationCallable(
acceptHubSpokeTransportSettings,
settings.acceptHubSpokeOperationSettings(),
clientContext,
operationsStub);
this.deleteSpokeCallable =
callableFactory.createUnaryCallable(
deleteSpokeTransportSettings, settings.deleteSpokeSettings(), clientContext);
this.deleteSpokeOperationCallable =
callableFactory.createOperationCallable(
deleteSpokeTransportSettings,
settings.deleteSpokeOperationSettings(),
clientContext,
operationsStub);
this.getRouteTableCallable =
callableFactory.createUnaryCallable(
getRouteTableTransportSettings, settings.getRouteTableSettings(), clientContext);
this.getRouteCallable =
callableFactory.createUnaryCallable(
getRouteTransportSettings, settings.getRouteSettings(), clientContext);
this.listRoutesCallable =
callableFactory.createUnaryCallable(
listRoutesTransportSettings, settings.listRoutesSettings(), clientContext);
this.listRoutesPagedCallable =
callableFactory.createPagedCallable(
listRoutesTransportSettings, settings.listRoutesSettings(), clientContext);
this.listRouteTablesCallable =
callableFactory.createUnaryCallable(
listRouteTablesTransportSettings, settings.listRouteTablesSettings(), clientContext);
this.listRouteTablesPagedCallable =
callableFactory.createPagedCallable(
listRouteTablesTransportSettings, settings.listRouteTablesSettings(), clientContext);
this.getGroupCallable =
callableFactory.createUnaryCallable(
getGroupTransportSettings, settings.getGroupSettings(), clientContext);
this.listGroupsCallable =
callableFactory.createUnaryCallable(
listGroupsTransportSettings, settings.listGroupsSettings(), clientContext);
this.listGroupsPagedCallable =
callableFactory.createPagedCallable(
listGroupsTransportSettings, settings.listGroupsSettings(), clientContext);
this.updateGroupCallable =
callableFactory.createUnaryCallable(
updateGroupTransportSettings, settings.updateGroupSettings(), clientContext);
this.updateGroupOperationCallable =
callableFactory.createOperationCallable(
updateGroupTransportSettings,
settings.updateGroupOperationSettings(),
clientContext,
operationsStub);
this.listLocationsCallable =
callableFactory.createUnaryCallable(
listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
this.listLocationsPagedCallable =
callableFactory.createPagedCallable(
listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
this.getLocationCallable =
callableFactory.createUnaryCallable(
getLocationTransportSettings, settings.getLocationSettings(), clientContext);
this.setIamPolicyCallable =
callableFactory.createUnaryCallable(
setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext);
this.getIamPolicyCallable =
callableFactory.createUnaryCallable(
getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext);
this.testIamPermissionsCallable =
callableFactory.createUnaryCallable(
testIamPermissionsTransportSettings,
settings.testIamPermissionsSettings(),
clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
public GrpcOperationsStub getOperationsStub() {
return operationsStub;
}
@Override
public UnaryCallable listHubsCallable() {
return listHubsCallable;
}
@Override
public UnaryCallable listHubsPagedCallable() {
return listHubsPagedCallable;
}
@Override
public UnaryCallable getHubCallable() {
return getHubCallable;
}
@Override
public UnaryCallable createHubCallable() {
return createHubCallable;
}
@Override
public OperationCallable createHubOperationCallable() {
return createHubOperationCallable;
}
@Override
public UnaryCallable updateHubCallable() {
return updateHubCallable;
}
@Override
public OperationCallable updateHubOperationCallable() {
return updateHubOperationCallable;
}
@Override
public UnaryCallable deleteHubCallable() {
return deleteHubCallable;
}
@Override
public OperationCallable
deleteHubOperationCallable() {
return deleteHubOperationCallable;
}
@Override
public UnaryCallable listHubSpokesCallable() {
return listHubSpokesCallable;
}
@Override
public UnaryCallable
listHubSpokesPagedCallable() {
return listHubSpokesPagedCallable;
}
@Override
public UnaryCallable queryHubStatusCallable() {
return queryHubStatusCallable;
}
@Override
public UnaryCallable
queryHubStatusPagedCallable() {
return queryHubStatusPagedCallable;
}
@Override
public UnaryCallable listSpokesCallable() {
return listSpokesCallable;
}
@Override
public UnaryCallable listSpokesPagedCallable() {
return listSpokesPagedCallable;
}
@Override
public UnaryCallable getSpokeCallable() {
return getSpokeCallable;
}
@Override
public UnaryCallable createSpokeCallable() {
return createSpokeCallable;
}
@Override
public OperationCallable
createSpokeOperationCallable() {
return createSpokeOperationCallable;
}
@Override
public UnaryCallable updateSpokeCallable() {
return updateSpokeCallable;
}
@Override
public OperationCallable
updateSpokeOperationCallable() {
return updateSpokeOperationCallable;
}
@Override
public UnaryCallable rejectHubSpokeCallable() {
return rejectHubSpokeCallable;
}
@Override
public OperationCallable
rejectHubSpokeOperationCallable() {
return rejectHubSpokeOperationCallable;
}
@Override
public UnaryCallable acceptHubSpokeCallable() {
return acceptHubSpokeCallable;
}
@Override
public OperationCallable
acceptHubSpokeOperationCallable() {
return acceptHubSpokeOperationCallable;
}
@Override
public UnaryCallable deleteSpokeCallable() {
return deleteSpokeCallable;
}
@Override
public OperationCallable
deleteSpokeOperationCallable() {
return deleteSpokeOperationCallable;
}
@Override
public UnaryCallable getRouteTableCallable() {
return getRouteTableCallable;
}
@Override
public UnaryCallable getRouteCallable() {
return getRouteCallable;
}
@Override
public UnaryCallable listRoutesCallable() {
return listRoutesCallable;
}
@Override
public UnaryCallable listRoutesPagedCallable() {
return listRoutesPagedCallable;
}
@Override
public UnaryCallable listRouteTablesCallable() {
return listRouteTablesCallable;
}
@Override
public UnaryCallable
listRouteTablesPagedCallable() {
return listRouteTablesPagedCallable;
}
@Override
public UnaryCallable getGroupCallable() {
return getGroupCallable;
}
@Override
public UnaryCallable listGroupsCallable() {
return listGroupsCallable;
}
@Override
public UnaryCallable listGroupsPagedCallable() {
return listGroupsPagedCallable;
}
@Override
public UnaryCallable updateGroupCallable() {
return updateGroupCallable;
}
@Override
public OperationCallable
updateGroupOperationCallable() {
return updateGroupOperationCallable;
}
@Override
public UnaryCallable listLocationsCallable() {
return listLocationsCallable;
}
@Override
public UnaryCallable
listLocationsPagedCallable() {
return listLocationsPagedCallable;
}
@Override
public UnaryCallable getLocationCallable() {
return getLocationCallable;
}
@Override
public UnaryCallable setIamPolicyCallable() {
return setIamPolicyCallable;
}
@Override
public UnaryCallable getIamPolicyCallable() {
return getIamPolicyCallable;
}
@Override
public UnaryCallable
testIamPermissionsCallable() {
return testIamPermissionsCallable;
}
@Override
public final void close() {
try {
backgroundResources.close();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new IllegalStateException("Failed to close resource", e);
}
}
@Override
public void shutdown() {
backgroundResources.shutdown();
}
@Override
public boolean isShutdown() {
return backgroundResources.isShutdown();
}
@Override
public boolean isTerminated() {
return backgroundResources.isTerminated();
}
@Override
public void shutdownNow() {
backgroundResources.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return backgroundResources.awaitTermination(duration, unit);
}
}