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

feat: add WriteFeatureValues in aiplatform v1beta1 featurestore_online_service.proto #1022

Merged
merged 4 commits into from
Aug 16, 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ implementation 'com.google.cloud:google-cloud-aiplatform'
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-aiplatform:3.1.0'
implementation 'com.google.cloud:google-cloud-aiplatform:3.2.0'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-aiplatform" % "3.1.0"
libraryDependencies += "com.google.cloud" % "google-cloud-aiplatform" % "3.2.0"
```

## Authentication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,153 @@ public final ReadFeatureValuesResponse readFeatureValues(ReadFeatureValuesReques
return stub.streamingReadFeatureValuesCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Writes Feature values of one or more entities of an EntityType.
*
* <p>The Feature values are merged into existing entities if any. The Feature values to be
* written must have timestamp within the online storage retention.
*
* <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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient =
* FeaturestoreOnlineServingServiceClient.create()) {
* EntityTypeName entityType =
* EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]");
* List<WriteFeatureValuesPayload> payloads = new ArrayList<>();
* WriteFeatureValuesResponse response =
* featurestoreOnlineServingServiceClient.writeFeatureValues(entityType, payloads);
* }
* }</pre>
*
* @param entityType Required. The resource name of the EntityType for the entities being written.
* Value format: `projects/{project}/locations/{location}/featurestores/
* {featurestore}/entityTypes/{entityType}`. For example, for a machine learning model
* predicting user clicks on a website, an EntityType ID could be `user`.
* @param payloads Required. The entities to be written. Up to 100,000 feature values can be
* written across all `payloads`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final WriteFeatureValuesResponse writeFeatureValues(
EntityTypeName entityType, List<WriteFeatureValuesPayload> payloads) {
WriteFeatureValuesRequest request =
WriteFeatureValuesRequest.newBuilder()
.setEntityType(entityType == null ? null : entityType.toString())
.addAllPayloads(payloads)
.build();
return writeFeatureValues(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Writes Feature values of one or more entities of an EntityType.
*
* <p>The Feature values are merged into existing entities if any. The Feature values to be
* written must have timestamp within the online storage retention.
*
* <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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient =
* FeaturestoreOnlineServingServiceClient.create()) {
* String entityType =
* EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]")
* .toString();
* List<WriteFeatureValuesPayload> payloads = new ArrayList<>();
* WriteFeatureValuesResponse response =
* featurestoreOnlineServingServiceClient.writeFeatureValues(entityType, payloads);
* }
* }</pre>
*
* @param entityType Required. The resource name of the EntityType for the entities being written.
* Value format: `projects/{project}/locations/{location}/featurestores/
* {featurestore}/entityTypes/{entityType}`. For example, for a machine learning model
* predicting user clicks on a website, an EntityType ID could be `user`.
* @param payloads Required. The entities to be written. Up to 100,000 feature values can be
* written across all `payloads`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final WriteFeatureValuesResponse writeFeatureValues(
String entityType, List<WriteFeatureValuesPayload> payloads) {
WriteFeatureValuesRequest request =
WriteFeatureValuesRequest.newBuilder()
.setEntityType(entityType)
.addAllPayloads(payloads)
.build();
return writeFeatureValues(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Writes Feature values of one or more entities of an EntityType.
*
* <p>The Feature values are merged into existing entities if any. The Feature values to be
* written must have timestamp within the online storage retention.
*
* <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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient =
* FeaturestoreOnlineServingServiceClient.create()) {
* WriteFeatureValuesRequest request =
* WriteFeatureValuesRequest.newBuilder()
* .setEntityType(
* EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]")
* .toString())
* .addAllPayloads(new ArrayList<WriteFeatureValuesPayload>())
* .build();
* WriteFeatureValuesResponse response =
* featurestoreOnlineServingServiceClient.writeFeatureValues(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 WriteFeatureValuesResponse writeFeatureValues(WriteFeatureValuesRequest request) {
return writeFeatureValuesCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Writes Feature values of one or more entities of an EntityType.
*
* <p>The Feature values are merged into existing entities if any. The Feature values to be
* written must have timestamp within the online storage retention.
*
* <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 (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient =
* FeaturestoreOnlineServingServiceClient.create()) {
* WriteFeatureValuesRequest request =
* WriteFeatureValuesRequest.newBuilder()
* .setEntityType(
* EntityTypeName.of("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]")
* .toString())
* .addAllPayloads(new ArrayList<WriteFeatureValuesPayload>())
* .build();
* ApiFuture<WriteFeatureValuesResponse> future =
* featurestoreOnlineServingServiceClient.writeFeatureValuesCallable().futureCall(request);
* // Do something.
* WriteFeatureValuesResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<WriteFeatureValuesRequest, WriteFeatureValuesResponse>
writeFeatureValuesCallable() {
return stub.writeFeatureValuesCallable();
}

// 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 @@ -99,6 +99,13 @@ public class FeaturestoreOnlineServingServiceSettings
.streamingReadFeatureValuesSettings();
}

/** Returns the object with the settings used for calls to writeFeatureValues. */
public UnaryCallSettings<WriteFeatureValuesRequest, WriteFeatureValuesResponse>
writeFeatureValuesSettings() {
return ((FeaturestoreOnlineServingServiceStubSettings) getStubSettings())
.writeFeatureValuesSettings();
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -241,6 +248,12 @@ public Builder applyToAllUnaryMethods(
return getStubSettingsBuilder().streamingReadFeatureValuesSettings();
}

/** Returns the builder for the settings used for calls to writeFeatureValues. */
public UnaryCallSettings.Builder<WriteFeatureValuesRequest, WriteFeatureValuesResponse>
writeFeatureValuesSettings() {
return getStubSettingsBuilder().writeFeatureValuesSettings();
}

/** 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 @@ -171,6 +171,9 @@
},
"TestIamPermissions": {
"methods": ["testIamPermissions", "testIamPermissionsCallable"]
},
"WriteFeatureValues": {
"methods": ["writeFeatureValues", "writeFeatureValues", "writeFeatureValues", "writeFeatureValuesCallable"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import com.google.cloud.aiplatform.v1beta1.ReadFeatureValuesRequest;
import com.google.cloud.aiplatform.v1beta1.ReadFeatureValuesResponse;
import com.google.cloud.aiplatform.v1beta1.StreamingReadFeatureValuesRequest;
import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesRequest;
import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesResponse;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
Expand Down Expand Up @@ -57,6 +59,11 @@ public abstract class FeaturestoreOnlineServingServiceStub implements Background
"Not implemented: streamingReadFeatureValuesCallable()");
}

public UnaryCallable<WriteFeatureValuesRequest, WriteFeatureValuesResponse>
writeFeatureValuesCallable() {
throw new UnsupportedOperationException("Not implemented: writeFeatureValuesCallable()");
}

public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
import com.google.cloud.aiplatform.v1beta1.ReadFeatureValuesRequest;
import com.google.cloud.aiplatform.v1beta1.ReadFeatureValuesResponse;
import com.google.cloud.aiplatform.v1beta1.StreamingReadFeatureValuesRequest;
import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesRequest;
import com.google.cloud.aiplatform.v1beta1.WriteFeatureValuesResponse;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
Expand Down Expand Up @@ -111,6 +113,8 @@ public class FeaturestoreOnlineServingServiceStubSettings
private final ServerStreamingCallSettings<
StreamingReadFeatureValuesRequest, ReadFeatureValuesResponse>
streamingReadFeatureValuesSettings;
private final UnaryCallSettings<WriteFeatureValuesRequest, WriteFeatureValuesResponse>
writeFeatureValuesSettings;
private final PagedCallSettings<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
Expand Down Expand Up @@ -185,6 +189,12 @@ public ApiFuture<ListLocationsPagedResponse> getFuturePagedResponse(
return streamingReadFeatureValuesSettings;
}

/** Returns the object with the settings used for calls to writeFeatureValues. */
public UnaryCallSettings<WriteFeatureValuesRequest, WriteFeatureValuesResponse>
writeFeatureValuesSettings() {
return writeFeatureValuesSettings;
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -292,6 +302,7 @@ protected FeaturestoreOnlineServingServiceStubSettings(Builder settingsBuilder)
readFeatureValuesSettings = settingsBuilder.readFeatureValuesSettings().build();
streamingReadFeatureValuesSettings =
settingsBuilder.streamingReadFeatureValuesSettings().build();
writeFeatureValuesSettings = settingsBuilder.writeFeatureValuesSettings().build();
listLocationsSettings = settingsBuilder.listLocationsSettings().build();
getLocationSettings = settingsBuilder.getLocationSettings().build();
setIamPolicySettings = settingsBuilder.setIamPolicySettings().build();
Expand All @@ -308,6 +319,8 @@ public static class Builder
private final ServerStreamingCallSettings.Builder<
StreamingReadFeatureValuesRequest, ReadFeatureValuesResponse>
streamingReadFeatureValuesSettings;
private final UnaryCallSettings.Builder<WriteFeatureValuesRequest, WriteFeatureValuesResponse>
writeFeatureValuesSettings;
private final PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
Expand Down Expand Up @@ -355,6 +368,7 @@ protected Builder(ClientContext clientContext) {

readFeatureValuesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
streamingReadFeatureValuesSettings = ServerStreamingCallSettings.newBuilder();
writeFeatureValuesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT);
getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
Expand All @@ -364,6 +378,7 @@ protected Builder(ClientContext clientContext) {
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
readFeatureValuesSettings,
writeFeatureValuesSettings,
listLocationsSettings,
getLocationSettings,
setIamPolicySettings,
Expand All @@ -377,6 +392,7 @@ protected Builder(FeaturestoreOnlineServingServiceStubSettings settings) {

readFeatureValuesSettings = settings.readFeatureValuesSettings.toBuilder();
streamingReadFeatureValuesSettings = settings.streamingReadFeatureValuesSettings.toBuilder();
writeFeatureValuesSettings = settings.writeFeatureValuesSettings.toBuilder();
listLocationsSettings = settings.listLocationsSettings.toBuilder();
getLocationSettings = settings.getLocationSettings.toBuilder();
setIamPolicySettings = settings.setIamPolicySettings.toBuilder();
Expand All @@ -386,6 +402,7 @@ protected Builder(FeaturestoreOnlineServingServiceStubSettings settings) {
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
readFeatureValuesSettings,
writeFeatureValuesSettings,
listLocationsSettings,
getLocationSettings,
setIamPolicySettings,
Expand Down Expand Up @@ -417,6 +434,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_13_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_13_params"));

builder
.writeFeatureValuesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.listLocationsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
Expand Down Expand Up @@ -473,6 +495,12 @@ public Builder applyToAllUnaryMethods(
return streamingReadFeatureValuesSettings;
}

/** Returns the builder for the settings used for calls to writeFeatureValues. */
public UnaryCallSettings.Builder<WriteFeatureValuesRequest, WriteFeatureValuesResponse>
writeFeatureValuesSettings() {
return writeFeatureValuesSettings;
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down
Loading