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

feat: add UpsertDatapoints and RemoveDatapoints rpcs to IndexService in aiplatform v1 index_service.proto #1030

Merged
merged 5 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,112 @@ public final UnaryCallable<DeleteIndexRequest, Operation> deleteIndexCallable()
return stub.deleteIndexCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Add/update Datapoints into an Index.
*
* <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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
* UpsertDatapointsRequest request =
* UpsertDatapointsRequest.newBuilder()
* .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
* .addAllDatapoints(new ArrayList<IndexDatapoint>())
* .build();
* UpsertDatapointsResponse response = indexServiceClient.upsertDatapoints(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 UpsertDatapointsResponse upsertDatapoints(UpsertDatapointsRequest request) {
return upsertDatapointsCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Add/update Datapoints into an Index.
*
* <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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
* UpsertDatapointsRequest request =
* UpsertDatapointsRequest.newBuilder()
* .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
* .addAllDatapoints(new ArrayList<IndexDatapoint>())
* .build();
* ApiFuture<UpsertDatapointsResponse> future =
* indexServiceClient.upsertDatapointsCallable().futureCall(request);
* // Do something.
* UpsertDatapointsResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<UpsertDatapointsRequest, UpsertDatapointsResponse>
upsertDatapointsCallable() {
return stub.upsertDatapointsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Remove Datapoints from an Index.
*
* <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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
* RemoveDatapointsRequest request =
* RemoveDatapointsRequest.newBuilder()
* .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
* .addAllDatapointIds(new ArrayList<String>())
* .build();
* RemoveDatapointsResponse response = indexServiceClient.removeDatapoints(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 RemoveDatapointsResponse removeDatapoints(RemoveDatapointsRequest request) {
return removeDatapointsCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Remove Datapoints from an Index.
*
* <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 (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
* RemoveDatapointsRequest request =
* RemoveDatapointsRequest.newBuilder()
* .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
* .addAllDatapointIds(new ArrayList<String>())
* .build();
* ApiFuture<RemoveDatapointsResponse> future =
* indexServiceClient.removeDatapointsCallable().futureCall(request);
* // Do something.
* RemoveDatapointsResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<RemoveDatapointsRequest, RemoveDatapointsResponse>
removeDatapointsCallable() {
return stub.removeDatapointsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ public UnaryCallSettings<DeleteIndexRequest, Operation> deleteIndexSettings() {
return ((IndexServiceStubSettings) getStubSettings()).deleteIndexOperationSettings();
}

/** Returns the object with the settings used for calls to upsertDatapoints. */
public UnaryCallSettings<UpsertDatapointsRequest, UpsertDatapointsResponse>
upsertDatapointsSettings() {
return ((IndexServiceStubSettings) getStubSettings()).upsertDatapointsSettings();
}

/** Returns the object with the settings used for calls to removeDatapoints. */
public UnaryCallSettings<RemoveDatapointsRequest, RemoveDatapointsResponse>
removeDatapointsSettings() {
return ((IndexServiceStubSettings) getStubSettings()).removeDatapointsSettings();
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -296,6 +308,18 @@ public UnaryCallSettings.Builder<DeleteIndexRequest, Operation> deleteIndexSetti
return getStubSettingsBuilder().deleteIndexOperationSettings();
}

/** Returns the builder for the settings used for calls to upsertDatapoints. */
public UnaryCallSettings.Builder<UpsertDatapointsRequest, UpsertDatapointsResponse>
upsertDatapointsSettings() {
return getStubSettingsBuilder().upsertDatapointsSettings();
}

/** Returns the builder for the settings used for calls to removeDatapoints. */
public UnaryCallSettings.Builder<RemoveDatapointsRequest, RemoveDatapointsResponse>
removeDatapointsSettings() {
return getStubSettingsBuilder().removeDatapointsSettings();
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1151,9 +1151,9 @@ public final UnaryCallable<DeleteModelVersionRequest, Operation> deleteModelVers
* explicitly included.
* <p>Example: `projects/{project}/locations/{location}/models/{model}{@literal @}1234`
* @param versionAliases Required. The set of version aliases to merge. The alias should be at
* most 128 characters, and match `[a-z][a-z0-9-]{0,126}[a-z-0-9]`. Add the `-` prefix to an
* alias means removing that alias from the version. `-` is NOT counted in the 128 characters.
* Example: `-golden` means removing the `golden` alias from the version.
* most 128 characters, and match `[a-z][a-zA-Z0-9-]{0,126}[a-z-0-9]`. Add the `-` prefix to
* an alias means removing that alias from the version. `-` is NOT counted in the 128
* characters. Example: `-golden` means removing the `golden` alias from the version.
* <p>There is NO ordering in aliases, which means 1) The aliases returned from GetModel API
* might not have the exactly same order from this MergeVersionAliases API. 2) Adding and
* deleting the same alias in the request is not recommended, and the 2 operations will be
Expand Down Expand Up @@ -1189,9 +1189,9 @@ public final Model mergeVersionAliases(ModelName name, List<String> versionAlias
* explicitly included.
* <p>Example: `projects/{project}/locations/{location}/models/{model}{@literal @}1234`
* @param versionAliases Required. The set of version aliases to merge. The alias should be at
* most 128 characters, and match `[a-z][a-z0-9-]{0,126}[a-z-0-9]`. Add the `-` prefix to an
* alias means removing that alias from the version. `-` is NOT counted in the 128 characters.
* Example: `-golden` means removing the `golden` alias from the version.
* most 128 characters, and match `[a-z][a-zA-Z0-9-]{0,126}[a-z-0-9]`. Add the `-` prefix to
* an alias means removing that alias from the version. `-` is NOT counted in the 128
* characters. Example: `-golden` means removing the `golden` alias from the version.
* <p>There is NO ordering in aliases, which means 1) The aliases returned from GetModel API
* might not have the exactly same order from this MergeVersionAliases API. 2) Adding and
* deleting the same alias in the request is not recommended, and the 2 operations will be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@
"ListLocations": {
"methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
},
"RemoveDatapoints": {
"methods": ["removeDatapoints", "removeDatapointsCallable"]
},
"SetIamPolicy": {
"methods": ["setIamPolicy", "setIamPolicyCallable"]
},
Expand All @@ -303,6 +306,9 @@
},
"UpdateIndex": {
"methods": ["updateIndexAsync", "updateIndexAsync", "updateIndexOperationCallable", "updateIndexCallable"]
},
"UpsertDatapoints": {
"methods": ["upsertDatapoints", "upsertDatapointsCallable"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@
import com.google.cloud.aiplatform.v1.Index;
import com.google.cloud.aiplatform.v1.ListIndexesRequest;
import com.google.cloud.aiplatform.v1.ListIndexesResponse;
import com.google.cloud.aiplatform.v1.RemoveDatapointsRequest;
import com.google.cloud.aiplatform.v1.RemoveDatapointsResponse;
import com.google.cloud.aiplatform.v1.UpdateIndexOperationMetadata;
import com.google.cloud.aiplatform.v1.UpdateIndexRequest;
import com.google.cloud.aiplatform.v1.UpsertDatapointsRequest;
import com.google.cloud.aiplatform.v1.UpsertDatapointsResponse;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
Expand Down Expand Up @@ -105,6 +109,28 @@ public class GrpcIndexServiceStub extends IndexServiceStub {
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();

private static final MethodDescriptor<UpsertDatapointsRequest, UpsertDatapointsResponse>
upsertDatapointsMethodDescriptor =
MethodDescriptor.<UpsertDatapointsRequest, UpsertDatapointsResponse>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.IndexService/UpsertDatapoints")
.setRequestMarshaller(
ProtoUtils.marshaller(UpsertDatapointsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(UpsertDatapointsResponse.getDefaultInstance()))
.build();

private static final MethodDescriptor<RemoveDatapointsRequest, RemoveDatapointsResponse>
removeDatapointsMethodDescriptor =
MethodDescriptor.<RemoveDatapointsRequest, RemoveDatapointsResponse>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.aiplatform.v1.IndexService/RemoveDatapoints")
.setRequestMarshaller(
ProtoUtils.marshaller(RemoveDatapointsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(RemoveDatapointsResponse.getDefaultInstance()))
.build();

private static final MethodDescriptor<ListLocationsRequest, ListLocationsResponse>
listLocationsMethodDescriptor =
MethodDescriptor.<ListLocationsRequest, ListLocationsResponse>newBuilder()
Expand Down Expand Up @@ -164,6 +190,10 @@ public class GrpcIndexServiceStub extends IndexServiceStub {
private final UnaryCallable<DeleteIndexRequest, Operation> deleteIndexCallable;
private final OperationCallable<DeleteIndexRequest, Empty, DeleteOperationMetadata>
deleteIndexOperationCallable;
private final UnaryCallable<UpsertDatapointsRequest, UpsertDatapointsResponse>
upsertDatapointsCallable;
private final UnaryCallable<RemoveDatapointsRequest, RemoveDatapointsResponse>
removeDatapointsCallable;
private final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable;
private final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable;
Expand Down Expand Up @@ -265,6 +295,28 @@ protected GrpcIndexServiceStub(
return params.build();
})
.build();
GrpcCallSettings<UpsertDatapointsRequest, UpsertDatapointsResponse>
upsertDatapointsTransportSettings =
GrpcCallSettings.<UpsertDatapointsRequest, UpsertDatapointsResponse>newBuilder()
.setMethodDescriptor(upsertDatapointsMethodDescriptor)
.setParamsExtractor(
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("index", String.valueOf(request.getIndex()));
return params.build();
})
.build();
GrpcCallSettings<RemoveDatapointsRequest, RemoveDatapointsResponse>
removeDatapointsTransportSettings =
GrpcCallSettings.<RemoveDatapointsRequest, RemoveDatapointsResponse>newBuilder()
.setMethodDescriptor(removeDatapointsMethodDescriptor)
.setParamsExtractor(
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("index", String.valueOf(request.getIndex()));
return params.build();
})
.build();
GrpcCallSettings<ListLocationsRequest, ListLocationsResponse> listLocationsTransportSettings =
GrpcCallSettings.<ListLocationsRequest, ListLocationsResponse>newBuilder()
.setMethodDescriptor(listLocationsMethodDescriptor)
Expand Down Expand Up @@ -353,6 +405,12 @@ protected GrpcIndexServiceStub(
settings.deleteIndexOperationSettings(),
clientContext,
operationsStub);
this.upsertDatapointsCallable =
callableFactory.createUnaryCallable(
upsertDatapointsTransportSettings, settings.upsertDatapointsSettings(), clientContext);
this.removeDatapointsCallable =
callableFactory.createUnaryCallable(
removeDatapointsTransportSettings, settings.removeDatapointsSettings(), clientContext);
this.listLocationsCallable =
callableFactory.createUnaryCallable(
listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
Expand Down Expand Up @@ -430,6 +488,18 @@ public UnaryCallable<DeleteIndexRequest, Operation> deleteIndexCallable() {
return deleteIndexOperationCallable;
}

@Override
public UnaryCallable<UpsertDatapointsRequest, UpsertDatapointsResponse>
upsertDatapointsCallable() {
return upsertDatapointsCallable;
}

@Override
public UnaryCallable<RemoveDatapointsRequest, RemoveDatapointsResponse>
removeDatapointsCallable() {
return removeDatapointsCallable;
}

@Override
public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
return listLocationsCallable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@
import com.google.cloud.aiplatform.v1.Index;
import com.google.cloud.aiplatform.v1.ListIndexesRequest;
import com.google.cloud.aiplatform.v1.ListIndexesResponse;
import com.google.cloud.aiplatform.v1.RemoveDatapointsRequest;
import com.google.cloud.aiplatform.v1.RemoveDatapointsResponse;
import com.google.cloud.aiplatform.v1.UpdateIndexOperationMetadata;
import com.google.cloud.aiplatform.v1.UpdateIndexRequest;
import com.google.cloud.aiplatform.v1.UpsertDatapointsRequest;
import com.google.cloud.aiplatform.v1.UpsertDatapointsResponse;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
Expand Down Expand Up @@ -98,6 +102,16 @@ public UnaryCallable<DeleteIndexRequest, Operation> deleteIndexCallable() {
throw new UnsupportedOperationException("Not implemented: deleteIndexCallable()");
}

public UnaryCallable<UpsertDatapointsRequest, UpsertDatapointsResponse>
upsertDatapointsCallable() {
throw new UnsupportedOperationException("Not implemented: upsertDatapointsCallable()");
}

public UnaryCallable<RemoveDatapointsRequest, RemoveDatapointsResponse>
removeDatapointsCallable() {
throw new UnsupportedOperationException("Not implemented: removeDatapointsCallable()");
}

public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
Expand Down
Loading