Skip to content
This repository has been archived by the owner on Sep 9, 2023. It is now read-only.

feat: add BatchImportModelEvaluationSlices API in aiplatform v1 model_service.proto #972

Merged
merged 9 commits into from
Jun 23, 2022
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,132 @@ public final ModelEvaluation importModelEvaluation(ImportModelEvaluationRequest
return stub.importModelEvaluationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Imports a list of externally generated ModelEvaluationSlice.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
* ModelEvaluationName parent =
* ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]");
* List<ModelEvaluationSlice> modelEvaluationSlices = new ArrayList<>();
* BatchImportModelEvaluationSlicesResponse response =
* modelServiceClient.batchImportModelEvaluationSlices(parent, modelEvaluationSlices);
* }
* }</pre>
*
* @param parent Required. The name of the parent ModelEvaluation resource. Format:
* `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}`
* @param modelEvaluationSlices Required. Model evaluation slice resource to be imported.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final BatchImportModelEvaluationSlicesResponse batchImportModelEvaluationSlices(
ModelEvaluationName parent, List<ModelEvaluationSlice> modelEvaluationSlices) {
BatchImportModelEvaluationSlicesRequest request =
BatchImportModelEvaluationSlicesRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.addAllModelEvaluationSlices(modelEvaluationSlices)
.build();
return batchImportModelEvaluationSlices(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Imports a list of externally generated ModelEvaluationSlice.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
* String parent =
* ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString();
* List<ModelEvaluationSlice> modelEvaluationSlices = new ArrayList<>();
* BatchImportModelEvaluationSlicesResponse response =
* modelServiceClient.batchImportModelEvaluationSlices(parent, modelEvaluationSlices);
* }
* }</pre>
*
* @param parent Required. The name of the parent ModelEvaluation resource. Format:
* `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}`
* @param modelEvaluationSlices Required. Model evaluation slice resource to be imported.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final BatchImportModelEvaluationSlicesResponse batchImportModelEvaluationSlices(
String parent, List<ModelEvaluationSlice> modelEvaluationSlices) {
BatchImportModelEvaluationSlicesRequest request =
BatchImportModelEvaluationSlicesRequest.newBuilder()
.setParent(parent)
.addAllModelEvaluationSlices(modelEvaluationSlices)
.build();
return batchImportModelEvaluationSlices(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Imports a list of externally generated ModelEvaluationSlice.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
* BatchImportModelEvaluationSlicesRequest request =
* BatchImportModelEvaluationSlicesRequest.newBuilder()
* .setParent(
* ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]")
* .toString())
* .addAllModelEvaluationSlices(new ArrayList<ModelEvaluationSlice>())
* .build();
* BatchImportModelEvaluationSlicesResponse response =
* modelServiceClient.batchImportModelEvaluationSlices(request);
* }
* }</pre>
*
* @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 BatchImportModelEvaluationSlicesResponse batchImportModelEvaluationSlices(
BatchImportModelEvaluationSlicesRequest request) {
return batchImportModelEvaluationSlicesCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Imports a list of externally generated ModelEvaluationSlice.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
* BatchImportModelEvaluationSlicesRequest request =
* BatchImportModelEvaluationSlicesRequest.newBuilder()
* .setParent(
* ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]")
* .toString())
* .addAllModelEvaluationSlices(new ArrayList<ModelEvaluationSlice>())
* .build();
* ApiFuture<BatchImportModelEvaluationSlicesResponse> future =
* modelServiceClient.batchImportModelEvaluationSlicesCallable().futureCall(request);
* // Do something.
* BatchImportModelEvaluationSlicesResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<
BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
batchImportModelEvaluationSlicesCallable() {
return stub.batchImportModelEvaluationSlicesCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a ModelEvaluation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ public UnaryCallSettings<ExportModelRequest, Operation> exportModelSettings() {
return ((ModelServiceStubSettings) getStubSettings()).importModelEvaluationSettings();
}

/** Returns the object with the settings used for calls to batchImportModelEvaluationSlices. */
public UnaryCallSettings<
BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
batchImportModelEvaluationSlicesSettings() {
return ((ModelServiceStubSettings) getStubSettings())
.batchImportModelEvaluationSlicesSettings();
}

/** Returns the object with the settings used for calls to getModelEvaluation. */
public UnaryCallSettings<GetModelEvaluationRequest, ModelEvaluation>
getModelEvaluationSettings() {
Expand Down Expand Up @@ -402,6 +410,13 @@ public UnaryCallSettings.Builder<ExportModelRequest, Operation> exportModelSetti
return getStubSettingsBuilder().importModelEvaluationSettings();
}

/** Returns the builder for the settings used for calls to batchImportModelEvaluationSlices. */
public UnaryCallSettings.Builder<
BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
batchImportModelEvaluationSlicesSettings() {
return getStubSettingsBuilder().batchImportModelEvaluationSlicesSettings();
}

/** Returns the builder for the settings used for calls to getModelEvaluation. */
public UnaryCallSettings.Builder<GetModelEvaluationRequest, ModelEvaluation>
getModelEvaluationSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,9 @@
"grpc": {
"libraryClient": "ModelServiceClient",
"rpcs": {
"BatchImportModelEvaluationSlices": {
"methods": ["batchImportModelEvaluationSlices", "batchImportModelEvaluationSlices", "batchImportModelEvaluationSlices", "batchImportModelEvaluationSlicesCallable"]
},
"DeleteModel": {
"methods": ["deleteModelAsync", "deleteModelAsync", "deleteModelAsync", "deleteModelOperationCallable", "deleteModelCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.aiplatform.v1.BatchImportModelEvaluationSlicesRequest;
import com.google.cloud.aiplatform.v1.BatchImportModelEvaluationSlicesResponse;
import com.google.cloud.aiplatform.v1.DeleteModelRequest;
import com.google.cloud.aiplatform.v1.DeleteModelVersionRequest;
import com.google.cloud.aiplatform.v1.DeleteOperationMetadata;
Expand Down Expand Up @@ -172,6 +174,23 @@ public class GrpcModelServiceStub extends ModelServiceStub {
.setResponseMarshaller(ProtoUtils.marshaller(ModelEvaluation.getDefaultInstance()))
.build();

private static final MethodDescriptor<
BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
batchImportModelEvaluationSlicesMethodDescriptor =
MethodDescriptor
.<BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
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<GetModelEvaluationRequest, ModelEvaluation>
getModelEvaluationMethodDescriptor =
MethodDescriptor.<GetModelEvaluationRequest, ModelEvaluation>newBuilder()
Expand Down Expand Up @@ -289,6 +308,9 @@ public class GrpcModelServiceStub extends ModelServiceStub {
exportModelOperationCallable;
private final UnaryCallable<ImportModelEvaluationRequest, ModelEvaluation>
importModelEvaluationCallable;
private final UnaryCallable<
BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
batchImportModelEvaluationSlicesCallable;
private final UnaryCallable<GetModelEvaluationRequest, ModelEvaluation>
getModelEvaluationCallable;
private final UnaryCallable<ListModelEvaluationsRequest, ListModelEvaluationsResponse>
Expand Down Expand Up @@ -455,6 +477,20 @@ protected GrpcModelServiceStub(
return params.build();
})
.build();
GrpcCallSettings<
BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
batchImportModelEvaluationSlicesTransportSettings =
GrpcCallSettings
.<BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
newBuilder()
.setMethodDescriptor(batchImportModelEvaluationSlicesMethodDescriptor)
.setParamsExtractor(
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
})
.build();
GrpcCallSettings<GetModelEvaluationRequest, ModelEvaluation>
getModelEvaluationTransportSettings =
GrpcCallSettings.<GetModelEvaluationRequest, ModelEvaluation>newBuilder()
Expand Down Expand Up @@ -622,6 +658,11 @@ protected GrpcModelServiceStub(
importModelEvaluationTransportSettings,
settings.importModelEvaluationSettings(),
clientContext);
this.batchImportModelEvaluationSlicesCallable =
callableFactory.createUnaryCallable(
batchImportModelEvaluationSlicesTransportSettings,
settings.batchImportModelEvaluationSlicesSettings(),
clientContext);
this.getModelEvaluationCallable =
callableFactory.createUnaryCallable(
getModelEvaluationTransportSettings,
Expand Down Expand Up @@ -768,6 +809,13 @@ public UnaryCallable<ExportModelRequest, Operation> exportModelCallable() {
return importModelEvaluationCallable;
}

@Override
public UnaryCallable<
BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
batchImportModelEvaluationSlicesCallable() {
return batchImportModelEvaluationSlicesCallable;
}

@Override
public UnaryCallable<GetModelEvaluationRequest, ModelEvaluation> getModelEvaluationCallable() {
return getModelEvaluationCallable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.aiplatform.v1.BatchImportModelEvaluationSlicesRequest;
import com.google.cloud.aiplatform.v1.BatchImportModelEvaluationSlicesResponse;
import com.google.cloud.aiplatform.v1.DeleteModelRequest;
import com.google.cloud.aiplatform.v1.DeleteModelVersionRequest;
import com.google.cloud.aiplatform.v1.DeleteOperationMetadata;
Expand Down Expand Up @@ -150,6 +152,13 @@ public UnaryCallable<ExportModelRequest, Operation> exportModelCallable() {
throw new UnsupportedOperationException("Not implemented: importModelEvaluationCallable()");
}

public UnaryCallable<
BatchImportModelEvaluationSlicesRequest, BatchImportModelEvaluationSlicesResponse>
batchImportModelEvaluationSlicesCallable() {
throw new UnsupportedOperationException(
"Not implemented: batchImportModelEvaluationSlicesCallable()");
}

public UnaryCallable<GetModelEvaluationRequest, ModelEvaluation> getModelEvaluationCallable() {
throw new UnsupportedOperationException("Not implemented: getModelEvaluationCallable()");
}
Expand Down
Loading