com.google.cloud.aiplatform.v1.stub.GrpcModelServiceStub Maven / Gradle / Ivy
Show all versions of google-cloud-aiplatform 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.aiplatform.v1.stub;
import static com.google.cloud.aiplatform.v1.ModelServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelEvaluationSlicesPagedResponse;
import static com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelEvaluationsPagedResponse;
import static com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelVersionsPagedResponse;
import static com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelsPagedResponse;
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.aiplatform.v1.BatchImportEvaluatedAnnotationsRequest;
import com.google.cloud.aiplatform.v1.BatchImportEvaluatedAnnotationsResponse;
import com.google.cloud.aiplatform.v1.BatchImportModelEvaluationSlicesRequest;
import com.google.cloud.aiplatform.v1.BatchImportModelEvaluationSlicesResponse;
import com.google.cloud.aiplatform.v1.CopyModelOperationMetadata;
import com.google.cloud.aiplatform.v1.CopyModelRequest;
import com.google.cloud.aiplatform.v1.CopyModelResponse;
import com.google.cloud.aiplatform.v1.DeleteModelRequest;
import com.google.cloud.aiplatform.v1.DeleteModelVersionRequest;
import com.google.cloud.aiplatform.v1.DeleteOperationMetadata;
import com.google.cloud.aiplatform.v1.ExportModelOperationMetadata;
import com.google.cloud.aiplatform.v1.ExportModelRequest;
import com.google.cloud.aiplatform.v1.ExportModelResponse;
import com.google.cloud.aiplatform.v1.GetModelEvaluationRequest;
import com.google.cloud.aiplatform.v1.GetModelEvaluationSliceRequest;
import com.google.cloud.aiplatform.v1.GetModelRequest;
import com.google.cloud.aiplatform.v1.ImportModelEvaluationRequest;
import com.google.cloud.aiplatform.v1.ListModelEvaluationSlicesRequest;
import com.google.cloud.aiplatform.v1.ListModelEvaluationSlicesResponse;
import com.google.cloud.aiplatform.v1.ListModelEvaluationsRequest;
import com.google.cloud.aiplatform.v1.ListModelEvaluationsResponse;
import com.google.cloud.aiplatform.v1.ListModelVersionsRequest;
import com.google.cloud.aiplatform.v1.ListModelVersionsResponse;
import com.google.cloud.aiplatform.v1.ListModelsRequest;
import com.google.cloud.aiplatform.v1.ListModelsResponse;
import com.google.cloud.aiplatform.v1.MergeVersionAliasesRequest;
import com.google.cloud.aiplatform.v1.Model;
import com.google.cloud.aiplatform.v1.ModelEvaluation;
import com.google.cloud.aiplatform.v1.ModelEvaluationSlice;
import com.google.cloud.aiplatform.v1.UpdateExplanationDatasetOperationMetadata;
import com.google.cloud.aiplatform.v1.UpdateExplanationDatasetRequest;
import com.google.cloud.aiplatform.v1.UpdateExplanationDatasetResponse;
import com.google.cloud.aiplatform.v1.UpdateModelRequest;
import com.google.cloud.aiplatform.v1.UploadModelOperationMetadata;
import com.google.cloud.aiplatform.v1.UploadModelRequest;
import com.google.cloud.aiplatform.v1.UploadModelResponse;
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.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 ModelService service API.
*
* This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator-java")
public class GrpcModelServiceStub extends ModelServiceStub {
private static final MethodDescriptor uploadModelMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/UploadModel")
.setRequestMarshaller(ProtoUtils.marshaller(UploadModelRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor getModelMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/GetModel")
.setRequestMarshaller(ProtoUtils.marshaller(GetModelRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Model.getDefaultInstance()))
.build();
private static final MethodDescriptor
listModelsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/ListModels")
.setRequestMarshaller(ProtoUtils.marshaller(ListModelsRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(ListModelsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
listModelVersionsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/ListModelVersions")
.setRequestMarshaller(
ProtoUtils.marshaller(ListModelVersionsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListModelVersionsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor updateModelMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/UpdateModel")
.setRequestMarshaller(ProtoUtils.marshaller(UpdateModelRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Model.getDefaultInstance()))
.build();
private static final MethodDescriptor
updateExplanationDatasetMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/UpdateExplanationDataset")
.setRequestMarshaller(
ProtoUtils.marshaller(UpdateExplanationDatasetRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor deleteModelMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/DeleteModel")
.setRequestMarshaller(ProtoUtils.marshaller(DeleteModelRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
deleteModelVersionMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/DeleteModelVersion")
.setRequestMarshaller(
ProtoUtils.marshaller(DeleteModelVersionRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
mergeVersionAliasesMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/MergeVersionAliases")
.setRequestMarshaller(
ProtoUtils.marshaller(MergeVersionAliasesRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Model.getDefaultInstance()))
.build();
private static final MethodDescriptor exportModelMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/ExportModel")
.setRequestMarshaller(ProtoUtils.marshaller(ExportModelRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor copyModelMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/CopyModel")
.setRequestMarshaller(ProtoUtils.marshaller(CopyModelRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
private static final MethodDescriptor
importModelEvaluationMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/ImportModelEvaluation")
.setRequestMarshaller(
ProtoUtils.marshaller(ImportModelEvaluationRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(ModelEvaluation.getDefaultInstance()))
.build();
private static final MethodDescriptor<
BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
batchImportModelEvaluationSlicesMethodDescriptor =
MethodDescriptor
.
newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.aiplatform.v1.ModelService/BatchImportModelEvaluationSlices")
.setRequestMarshaller(
ProtoUtils.marshaller(
BatchImportModelEvaluationSlicesRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(
BatchImportModelEvaluationSlicesResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor<
BatchImportEvaluatedAnnotationsRequest, BatchImportEvaluatedAnnotationsResponse>
batchImportEvaluatedAnnotationsMethodDescriptor =
MethodDescriptor
.
newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.aiplatform.v1.ModelService/BatchImportEvaluatedAnnotations")
.setRequestMarshaller(
ProtoUtils.marshaller(
BatchImportEvaluatedAnnotationsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(
BatchImportEvaluatedAnnotationsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
getModelEvaluationMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/GetModelEvaluation")
.setRequestMarshaller(
ProtoUtils.marshaller(GetModelEvaluationRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(ModelEvaluation.getDefaultInstance()))
.build();
private static final MethodDescriptor
listModelEvaluationsMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/ListModelEvaluations")
.setRequestMarshaller(
ProtoUtils.marshaller(ListModelEvaluationsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListModelEvaluationsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor
getModelEvaluationSliceMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.ModelService/GetModelEvaluationSlice")
.setRequestMarshaller(
ProtoUtils.marshaller(GetModelEvaluationSliceRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ModelEvaluationSlice.getDefaultInstance()))
.build();
private static final MethodDescriptor<
ListModelEvaluationSlicesRequest, ListModelEvaluationSlicesResponse>
listModelEvaluationSlicesMethodDescriptor =
MethodDescriptor
.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.aiplatform.v1.ModelService/ListModelEvaluationSlices")
.setRequestMarshaller(
ProtoUtils.marshaller(ListModelEvaluationSlicesRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListModelEvaluationSlicesResponse.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 uploadModelCallable;
private final OperationCallable<
UploadModelRequest, UploadModelResponse, UploadModelOperationMetadata>
uploadModelOperationCallable;
private final UnaryCallable getModelCallable;
private final UnaryCallable listModelsCallable;
private final UnaryCallable listModelsPagedCallable;
private final UnaryCallable
listModelVersionsCallable;
private final UnaryCallable
listModelVersionsPagedCallable;
private final UnaryCallable updateModelCallable;
private final UnaryCallable
updateExplanationDatasetCallable;
private final OperationCallable<
UpdateExplanationDatasetRequest,
UpdateExplanationDatasetResponse,
UpdateExplanationDatasetOperationMetadata>
updateExplanationDatasetOperationCallable;
private final UnaryCallable deleteModelCallable;
private final OperationCallable
deleteModelOperationCallable;
private final UnaryCallable deleteModelVersionCallable;
private final OperationCallable
deleteModelVersionOperationCallable;
private final UnaryCallable mergeVersionAliasesCallable;
private final UnaryCallable exportModelCallable;
private final OperationCallable<
ExportModelRequest, ExportModelResponse, ExportModelOperationMetadata>
exportModelOperationCallable;
private final UnaryCallable copyModelCallable;
private final OperationCallable
copyModelOperationCallable;
private final UnaryCallable
importModelEvaluationCallable;
private final UnaryCallable<
BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
batchImportModelEvaluationSlicesCallable;
private final UnaryCallable<
BatchImportEvaluatedAnnotationsRequest, BatchImportEvaluatedAnnotationsResponse>
batchImportEvaluatedAnnotationsCallable;
private final UnaryCallable
getModelEvaluationCallable;
private final UnaryCallable
listModelEvaluationsCallable;
private final UnaryCallable
listModelEvaluationsPagedCallable;
private final UnaryCallable
getModelEvaluationSliceCallable;
private final UnaryCallable
listModelEvaluationSlicesCallable;
private final UnaryCallable<
ListModelEvaluationSlicesRequest, ListModelEvaluationSlicesPagedResponse>
listModelEvaluationSlicesPagedCallable;
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 GrpcModelServiceStub create(ModelServiceStubSettings settings)
throws IOException {
return new GrpcModelServiceStub(settings, ClientContext.create(settings));
}
public static final GrpcModelServiceStub create(ClientContext clientContext) throws IOException {
return new GrpcModelServiceStub(ModelServiceStubSettings.newBuilder().build(), clientContext);
}
public static final GrpcModelServiceStub create(
ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
return new GrpcModelServiceStub(
ModelServiceStubSettings.newBuilder().build(), clientContext, callableFactory);
}
/**
* Constructs an instance of GrpcModelServiceStub, 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 GrpcModelServiceStub(ModelServiceStubSettings settings, ClientContext clientContext)
throws IOException {
this(settings, clientContext, new GrpcModelServiceCallableFactory());
}
/**
* Constructs an instance of GrpcModelServiceStub, 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 GrpcModelServiceStub(
ModelServiceStubSettings settings,
ClientContext clientContext,
GrpcStubCallableFactory callableFactory)
throws IOException {
this.callableFactory = callableFactory;
this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
GrpcCallSettings uploadModelTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(uploadModelMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings getModelTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getModelMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings listModelsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listModelsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings
listModelVersionsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listModelVersionsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings updateModelTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateModelMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("model.name", String.valueOf(request.getModel().getName()));
return builder.build();
})
.build();
GrpcCallSettings
updateExplanationDatasetTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(updateExplanationDatasetMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("model", String.valueOf(request.getModel()));
return builder.build();
})
.build();
GrpcCallSettings deleteModelTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteModelMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings deleteModelVersionTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(deleteModelVersionMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings mergeVersionAliasesTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(mergeVersionAliasesMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings exportModelTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(exportModelMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings copyModelTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(copyModelMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings
importModelEvaluationTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(importModelEvaluationMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings<
BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
batchImportModelEvaluationSlicesTransportSettings =
GrpcCallSettings
.
newBuilder()
.setMethodDescriptor(batchImportModelEvaluationSlicesMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings<
BatchImportEvaluatedAnnotationsRequest, BatchImportEvaluatedAnnotationsResponse>
batchImportEvaluatedAnnotationsTransportSettings =
GrpcCallSettings
.
newBuilder()
.setMethodDescriptor(batchImportEvaluatedAnnotationsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings
getModelEvaluationTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getModelEvaluationMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
listModelEvaluationsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listModelEvaluationsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings
getModelEvaluationSliceTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(getModelEvaluationSliceMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings
listModelEvaluationSlicesTransportSettings =
GrpcCallSettings
.newBuilder()
.setMethodDescriptor(listModelEvaluationSlicesMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
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.uploadModelCallable =
callableFactory.createUnaryCallable(
uploadModelTransportSettings, settings.uploadModelSettings(), clientContext);
this.uploadModelOperationCallable =
callableFactory.createOperationCallable(
uploadModelTransportSettings,
settings.uploadModelOperationSettings(),
clientContext,
operationsStub);
this.getModelCallable =
callableFactory.createUnaryCallable(
getModelTransportSettings, settings.getModelSettings(), clientContext);
this.listModelsCallable =
callableFactory.createUnaryCallable(
listModelsTransportSettings, settings.listModelsSettings(), clientContext);
this.listModelsPagedCallable =
callableFactory.createPagedCallable(
listModelsTransportSettings, settings.listModelsSettings(), clientContext);
this.listModelVersionsCallable =
callableFactory.createUnaryCallable(
listModelVersionsTransportSettings,
settings.listModelVersionsSettings(),
clientContext);
this.listModelVersionsPagedCallable =
callableFactory.createPagedCallable(
listModelVersionsTransportSettings,
settings.listModelVersionsSettings(),
clientContext);
this.updateModelCallable =
callableFactory.createUnaryCallable(
updateModelTransportSettings, settings.updateModelSettings(), clientContext);
this.updateExplanationDatasetCallable =
callableFactory.createUnaryCallable(
updateExplanationDatasetTransportSettings,
settings.updateExplanationDatasetSettings(),
clientContext);
this.updateExplanationDatasetOperationCallable =
callableFactory.createOperationCallable(
updateExplanationDatasetTransportSettings,
settings.updateExplanationDatasetOperationSettings(),
clientContext,
operationsStub);
this.deleteModelCallable =
callableFactory.createUnaryCallable(
deleteModelTransportSettings, settings.deleteModelSettings(), clientContext);
this.deleteModelOperationCallable =
callableFactory.createOperationCallable(
deleteModelTransportSettings,
settings.deleteModelOperationSettings(),
clientContext,
operationsStub);
this.deleteModelVersionCallable =
callableFactory.createUnaryCallable(
deleteModelVersionTransportSettings,
settings.deleteModelVersionSettings(),
clientContext);
this.deleteModelVersionOperationCallable =
callableFactory.createOperationCallable(
deleteModelVersionTransportSettings,
settings.deleteModelVersionOperationSettings(),
clientContext,
operationsStub);
this.mergeVersionAliasesCallable =
callableFactory.createUnaryCallable(
mergeVersionAliasesTransportSettings,
settings.mergeVersionAliasesSettings(),
clientContext);
this.exportModelCallable =
callableFactory.createUnaryCallable(
exportModelTransportSettings, settings.exportModelSettings(), clientContext);
this.exportModelOperationCallable =
callableFactory.createOperationCallable(
exportModelTransportSettings,
settings.exportModelOperationSettings(),
clientContext,
operationsStub);
this.copyModelCallable =
callableFactory.createUnaryCallable(
copyModelTransportSettings, settings.copyModelSettings(), clientContext);
this.copyModelOperationCallable =
callableFactory.createOperationCallable(
copyModelTransportSettings,
settings.copyModelOperationSettings(),
clientContext,
operationsStub);
this.importModelEvaluationCallable =
callableFactory.createUnaryCallable(
importModelEvaluationTransportSettings,
settings.importModelEvaluationSettings(),
clientContext);
this.batchImportModelEvaluationSlicesCallable =
callableFactory.createUnaryCallable(
batchImportModelEvaluationSlicesTransportSettings,
settings.batchImportModelEvaluationSlicesSettings(),
clientContext);
this.batchImportEvaluatedAnnotationsCallable =
callableFactory.createUnaryCallable(
batchImportEvaluatedAnnotationsTransportSettings,
settings.batchImportEvaluatedAnnotationsSettings(),
clientContext);
this.getModelEvaluationCallable =
callableFactory.createUnaryCallable(
getModelEvaluationTransportSettings,
settings.getModelEvaluationSettings(),
clientContext);
this.listModelEvaluationsCallable =
callableFactory.createUnaryCallable(
listModelEvaluationsTransportSettings,
settings.listModelEvaluationsSettings(),
clientContext);
this.listModelEvaluationsPagedCallable =
callableFactory.createPagedCallable(
listModelEvaluationsTransportSettings,
settings.listModelEvaluationsSettings(),
clientContext);
this.getModelEvaluationSliceCallable =
callableFactory.createUnaryCallable(
getModelEvaluationSliceTransportSettings,
settings.getModelEvaluationSliceSettings(),
clientContext);
this.listModelEvaluationSlicesCallable =
callableFactory.createUnaryCallable(
listModelEvaluationSlicesTransportSettings,
settings.listModelEvaluationSlicesSettings(),
clientContext);
this.listModelEvaluationSlicesPagedCallable =
callableFactory.createPagedCallable(
listModelEvaluationSlicesTransportSettings,
settings.listModelEvaluationSlicesSettings(),
clientContext);
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 uploadModelCallable() {
return uploadModelCallable;
}
@Override
public OperationCallable
uploadModelOperationCallable() {
return uploadModelOperationCallable;
}
@Override
public UnaryCallable getModelCallable() {
return getModelCallable;
}
@Override
public UnaryCallable listModelsCallable() {
return listModelsCallable;
}
@Override
public UnaryCallable listModelsPagedCallable() {
return listModelsPagedCallable;
}
@Override
public UnaryCallable
listModelVersionsCallable() {
return listModelVersionsCallable;
}
@Override
public UnaryCallable
listModelVersionsPagedCallable() {
return listModelVersionsPagedCallable;
}
@Override
public UnaryCallable updateModelCallable() {
return updateModelCallable;
}
@Override
public UnaryCallable
updateExplanationDatasetCallable() {
return updateExplanationDatasetCallable;
}
@Override
public OperationCallable<
UpdateExplanationDatasetRequest,
UpdateExplanationDatasetResponse,
UpdateExplanationDatasetOperationMetadata>
updateExplanationDatasetOperationCallable() {
return updateExplanationDatasetOperationCallable;
}
@Override
public UnaryCallable deleteModelCallable() {
return deleteModelCallable;
}
@Override
public OperationCallable
deleteModelOperationCallable() {
return deleteModelOperationCallable;
}
@Override
public UnaryCallable deleteModelVersionCallable() {
return deleteModelVersionCallable;
}
@Override
public OperationCallable
deleteModelVersionOperationCallable() {
return deleteModelVersionOperationCallable;
}
@Override
public UnaryCallable mergeVersionAliasesCallable() {
return mergeVersionAliasesCallable;
}
@Override
public UnaryCallable exportModelCallable() {
return exportModelCallable;
}
@Override
public OperationCallable
exportModelOperationCallable() {
return exportModelOperationCallable;
}
@Override
public UnaryCallable copyModelCallable() {
return copyModelCallable;
}
@Override
public OperationCallable
copyModelOperationCallable() {
return copyModelOperationCallable;
}
@Override
public UnaryCallable
importModelEvaluationCallable() {
return importModelEvaluationCallable;
}
@Override
public UnaryCallable<
BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
batchImportModelEvaluationSlicesCallable() {
return batchImportModelEvaluationSlicesCallable;
}
@Override
public UnaryCallable<
BatchImportEvaluatedAnnotationsRequest, BatchImportEvaluatedAnnotationsResponse>
batchImportEvaluatedAnnotationsCallable() {
return batchImportEvaluatedAnnotationsCallable;
}
@Override
public UnaryCallable getModelEvaluationCallable() {
return getModelEvaluationCallable;
}
@Override
public UnaryCallable
listModelEvaluationsCallable() {
return listModelEvaluationsCallable;
}
@Override
public UnaryCallable
listModelEvaluationsPagedCallable() {
return listModelEvaluationsPagedCallable;
}
@Override
public UnaryCallable
getModelEvaluationSliceCallable() {
return getModelEvaluationSliceCallable;
}
@Override
public UnaryCallable
listModelEvaluationSlicesCallable() {
return listModelEvaluationSlicesCallable;
}
@Override
public UnaryCallable
listModelEvaluationSlicesPagedCallable() {
return listModelEvaluationSlicesPagedCallable;
}
@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);
}
}