diff --git a/java-discoveryengine/.gitignore b/java-discoveryengine/.gitignore new file mode 100644 index 000000000000..069d08fc73e8 --- /dev/null +++ b/java-discoveryengine/.gitignore @@ -0,0 +1,17 @@ +# Maven +target/ + +# Eclipse +.classpath +.project +.settings + +# Intellij +*.iml +.idea/ + +# python utilities +*.pyc +__pycache__ + +.flattened-pom.xml diff --git a/java-discoveryengine/README.md b/java-discoveryengine/README.md index b1282f338650..c075b52307ab 100644 --- a/java-discoveryengine/README.md +++ b/java-discoveryengine/README.md @@ -22,20 +22,20 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-discoveryengine - 0.0.0 + 0.1.0 ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-discoveryengine:0.0.0' +implementation 'com.google.cloud:google-cloud-discoveryengine:0.1.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-discoveryengine" % "0.0.0" +libraryDependencies += "com.google.cloud" % "google-cloud-discoveryengine" % "0.1.0" ``` ## Authentication diff --git a/java-discoveryengine/google-cloud-discoveryengine-bom/pom.xml b/java-discoveryengine/google-cloud-discoveryengine-bom/pom.xml index 616d2cd9fa1b..f1ff9ab4052a 100644 --- a/java-discoveryengine/google-cloud-discoveryengine-bom/pom.xml +++ b/java-discoveryengine/google-cloud-discoveryengine-bom/pom.xml @@ -1,4 +1,4 @@ - + 4.0.0 com.google.cloud diff --git a/java-discoveryengine/google-cloud-discoveryengine/pom.xml b/java-discoveryengine/google-cloud-discoveryengine/pom.xml index e7a61b4c6c40..bcf1970e39d5 100644 --- a/java-discoveryengine/google-cloud-discoveryengine/pom.xml +++ b/java-discoveryengine/google-cloud-discoveryengine/pom.xml @@ -1,4 +1,4 @@ - + 4.0.0 com.google.cloud @@ -110,4 +110,4 @@ test - \ No newline at end of file + diff --git a/java-discoveryengine/google-cloud-discoveryengine/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceClient.java b/java-discoveryengine/google-cloud-discoveryengine/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceClient.java index 05fdfbac07af..8391618ebad1 100644 --- a/java-discoveryengine/google-cloud-discoveryengine/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceClient.java +++ b/java-discoveryengine/google-cloud-discoveryengine/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceClient.java @@ -51,6 +51,7 @@ * .setFilter("filter-1274492040") * .setValidateOnly(true) * .putAllParams(new HashMap()) + * .putAllUserLabels(new HashMap()) * .build(); * RecommendResponse response = recommendationServiceClient.recommend(request); * } @@ -209,6 +210,7 @@ public RecommendationServiceStub getStub() { * .setFilter("filter-1274492040") * .setValidateOnly(true) * .putAllParams(new HashMap()) + * .putAllUserLabels(new HashMap()) * .build(); * RecommendResponse response = recommendationServiceClient.recommend(request); * } @@ -246,6 +248,7 @@ public final RecommendResponse recommend(RecommendRequest request) { * .setFilter("filter-1274492040") * .setValidateOnly(true) * .putAllParams(new HashMap()) + * .putAllUserLabels(new HashMap()) * .build(); * ApiFuture future = * recommendationServiceClient.recommendCallable().futureCall(request); diff --git a/java-discoveryengine/google-cloud-discoveryengine/src/main/java/com/google/cloud/discoveryengine/v1beta/package-info.java b/java-discoveryengine/google-cloud-discoveryengine/src/main/java/com/google/cloud/discoveryengine/v1beta/package-info.java index 2f021c0c5d85..bd70cd78ea8d 100644 --- a/java-discoveryengine/google-cloud-discoveryengine/src/main/java/com/google/cloud/discoveryengine/v1beta/package-info.java +++ b/java-discoveryengine/google-cloud-discoveryengine/src/main/java/com/google/cloud/discoveryengine/v1beta/package-info.java @@ -64,6 +64,7 @@ * .setFilter("filter-1274492040") * .setValidateOnly(true) * .putAllParams(new HashMap()) + * .putAllUserLabels(new HashMap()) * .build(); * RecommendResponse response = recommendationServiceClient.recommend(request); * } diff --git a/java-discoveryengine/google-cloud-discoveryengine/src/test/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceClientHttpJsonTest.java b/java-discoveryengine/google-cloud-discoveryengine/src/test/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceClientHttpJsonTest.java index 526a629654af..06841e434940 100644 --- a/java-discoveryengine/google-cloud-discoveryengine/src/test/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceClientHttpJsonTest.java +++ b/java-discoveryengine/google-cloud-discoveryengine/src/test/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceClientHttpJsonTest.java @@ -95,6 +95,7 @@ public void recommendTest() throws Exception { .setFilter("filter-1274492040") .setValidateOnly(true) .putAllParams(new HashMap()) + .putAllUserLabels(new HashMap()) .build(); RecommendResponse actualResponse = client.recommend(request); @@ -134,6 +135,7 @@ public void recommendExceptionTest() throws Exception { .setFilter("filter-1274492040") .setValidateOnly(true) .putAllParams(new HashMap()) + .putAllUserLabels(new HashMap()) .build(); client.recommend(request); Assert.fail("No exception raised"); diff --git a/java-discoveryengine/google-cloud-discoveryengine/src/test/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceClientTest.java b/java-discoveryengine/google-cloud-discoveryengine/src/test/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceClientTest.java index 8d3b404f5dc9..582dc44c3c64 100644 --- a/java-discoveryengine/google-cloud-discoveryengine/src/test/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceClientTest.java +++ b/java-discoveryengine/google-cloud-discoveryengine/src/test/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceClientTest.java @@ -100,6 +100,7 @@ public void recommendTest() throws Exception { .setFilter("filter-1274492040") .setValidateOnly(true) .putAllParams(new HashMap()) + .putAllUserLabels(new HashMap()) .build(); RecommendResponse actualResponse = client.recommend(request); @@ -115,6 +116,7 @@ public void recommendTest() throws Exception { Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); Assert.assertEquals(request.getValidateOnly(), actualRequest.getValidateOnly()); Assert.assertEquals(request.getParamsMap(), actualRequest.getParamsMap()); + Assert.assertEquals(request.getUserLabelsMap(), actualRequest.getUserLabelsMap()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -138,6 +140,7 @@ public void recommendExceptionTest() throws Exception { .setFilter("filter-1274492040") .setValidateOnly(true) .putAllParams(new HashMap()) + .putAllUserLabels(new HashMap()) .build(); client.recommend(request); Assert.fail("No exception raised"); diff --git a/java-discoveryengine/pom.xml b/java-discoveryengine/pom.xml index af2b4945ec91..0bc53df4e81b 100644 --- a/java-discoveryengine/pom.xml +++ b/java-discoveryengine/pom.xml @@ -50,4 +50,5 @@ proto-google-cloud-discoveryengine-v1beta google-cloud-discoveryengine-bom - + + diff --git a/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendRequest.java b/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendRequest.java index be75da65107d..d50f3bc87ee1 100644 --- a/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendRequest.java +++ b/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendRequest.java @@ -64,6 +64,8 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { switch (number) { case 6: return internalGetParams(); + case 8: + return internalGetUserLabels(); default: throw new RuntimeException("Invalid map field number: " + number); } @@ -535,6 +537,161 @@ public com.google.protobuf.Value getParamsOrThrow(java.lang.String key) { return map.get(key); } + public static final int USER_LABELS_FIELD_NUMBER = 8; + + private static final class UserLabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.discoveryengine.v1beta.RecommendationServiceProto + .internal_static_google_cloud_discoveryengine_v1beta_RecommendRequest_UserLabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField userLabels_; + + private com.google.protobuf.MapField internalGetUserLabels() { + if (userLabels_ == null) { + return com.google.protobuf.MapField.emptyMapField(UserLabelsDefaultEntryHolder.defaultEntry); + } + return userLabels_; + } + + public int getUserLabelsCount() { + return internalGetUserLabels().getMap().size(); + } + /** + * + * + *
+   * The user labels applied to a resource must meet the following requirements:
+   * * Each resource can have multiple labels, up to a maximum of 64.
+   * * Each label must be a key-value pair.
+   * * Keys have a minimum length of 1 character and a maximum length of 63
+   *   characters and cannot be empty. Values can be empty and have a maximum
+   *   length of 63 characters.
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   *   underscores, and dashes. All characters must use UTF-8 encoding, and
+   *   international characters are allowed.
+   * * The key portion of a label must be unique. However, you can use the same
+   *   key with multiple resources.
+   * * Keys must start with a lowercase letter or international character.
+   * See [Google Cloud
+   * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+   * for more details.
+   * 
+ * + * map<string, string> user_labels = 8; + */ + @java.lang.Override + public boolean containsUserLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetUserLabels().getMap().containsKey(key); + } + /** Use {@link #getUserLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getUserLabels() { + return getUserLabelsMap(); + } + /** + * + * + *
+   * The user labels applied to a resource must meet the following requirements:
+   * * Each resource can have multiple labels, up to a maximum of 64.
+   * * Each label must be a key-value pair.
+   * * Keys have a minimum length of 1 character and a maximum length of 63
+   *   characters and cannot be empty. Values can be empty and have a maximum
+   *   length of 63 characters.
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   *   underscores, and dashes. All characters must use UTF-8 encoding, and
+   *   international characters are allowed.
+   * * The key portion of a label must be unique. However, you can use the same
+   *   key with multiple resources.
+   * * Keys must start with a lowercase letter or international character.
+   * See [Google Cloud
+   * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+   * for more details.
+   * 
+ * + * map<string, string> user_labels = 8; + */ + @java.lang.Override + public java.util.Map getUserLabelsMap() { + return internalGetUserLabels().getMap(); + } + /** + * + * + *
+   * The user labels applied to a resource must meet the following requirements:
+   * * Each resource can have multiple labels, up to a maximum of 64.
+   * * Each label must be a key-value pair.
+   * * Keys have a minimum length of 1 character and a maximum length of 63
+   *   characters and cannot be empty. Values can be empty and have a maximum
+   *   length of 63 characters.
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   *   underscores, and dashes. All characters must use UTF-8 encoding, and
+   *   international characters are allowed.
+   * * The key portion of a label must be unique. However, you can use the same
+   *   key with multiple resources.
+   * * Keys must start with a lowercase letter or international character.
+   * See [Google Cloud
+   * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+   * for more details.
+   * 
+ * + * map<string, string> user_labels = 8; + */ + @java.lang.Override + public java.lang.String getUserLabelsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetUserLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * The user labels applied to a resource must meet the following requirements:
+   * * Each resource can have multiple labels, up to a maximum of 64.
+   * * Each label must be a key-value pair.
+   * * Keys have a minimum length of 1 character and a maximum length of 63
+   *   characters and cannot be empty. Values can be empty and have a maximum
+   *   length of 63 characters.
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   *   underscores, and dashes. All characters must use UTF-8 encoding, and
+   *   international characters are allowed.
+   * * The key portion of a label must be unique. However, you can use the same
+   *   key with multiple resources.
+   * * Keys must start with a lowercase letter or international character.
+   * See [Google Cloud
+   * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+   * for more details.
+   * 
+ * + * map<string, string> user_labels = 8; + */ + @java.lang.Override + public java.lang.String getUserLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetUserLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -566,6 +723,8 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io } com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( output, internalGetParams(), ParamsDefaultEntryHolder.defaultEntry, 6); + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetUserLabels(), UserLabelsDefaultEntryHolder.defaultEntry, 8); getUnknownFields().writeTo(output); } @@ -600,6 +759,16 @@ public int getSerializedSize() { .build(); size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, params__); } + for (java.util.Map.Entry entry : + internalGetUserLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry userLabels__ = + UserLabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, userLabels__); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -625,6 +794,7 @@ public boolean equals(final java.lang.Object obj) { if (!getFilter().equals(other.getFilter())) return false; if (getValidateOnly() != other.getValidateOnly()) return false; if (!internalGetParams().equals(other.internalGetParams())) return false; + if (!internalGetUserLabels().equals(other.internalGetUserLabels())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -652,6 +822,10 @@ public int hashCode() { hash = (37 * hash) + PARAMS_FIELD_NUMBER; hash = (53 * hash) + internalGetParams().hashCode(); } + if (!internalGetUserLabels().getMap().isEmpty()) { + hash = (37 * hash) + USER_LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetUserLabels().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -776,6 +950,8 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { switch (number) { case 6: return internalGetParams(); + case 8: + return internalGetUserLabels(); default: throw new RuntimeException("Invalid map field number: " + number); } @@ -786,6 +962,8 @@ protected com.google.protobuf.MapField internalGetMutableMapField(int number) { switch (number) { case 6: return internalGetMutableParams(); + case 8: + return internalGetMutableUserLabels(); default: throw new RuntimeException("Invalid map field number: " + number); } @@ -826,6 +1004,7 @@ public Builder clear() { validateOnly_ = false; internalGetMutableParams().clear(); + internalGetMutableUserLabels().clear(); return this; } @@ -865,6 +1044,8 @@ public com.google.cloud.discoveryengine.v1beta.RecommendRequest buildPartial() { result.validateOnly_ = validateOnly_; result.params_ = internalGetParams(); result.params_.makeImmutable(); + result.userLabels_ = internalGetUserLabels(); + result.userLabels_.makeImmutable(); onBuilt(); return result; } @@ -933,6 +1114,7 @@ public Builder mergeFrom(com.google.cloud.discoveryengine.v1beta.RecommendReques setValidateOnly(other.getValidateOnly()); } internalGetMutableParams().mergeFrom(other.internalGetParams()); + internalGetMutableUserLabels().mergeFrom(other.internalGetUserLabels()); this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -1000,6 +1182,17 @@ public Builder mergeFrom( .put(params__.getKey(), params__.getValue()); break; } // case 50 + case 66: + { + com.google.protobuf.MapEntry userLabels__ = + input.readMessage( + UserLabelsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableUserLabels() + .getMutableMap() + .put(userLabels__.getKey(), userLabels__.getValue()); + break; + } // case 66 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -2074,6 +2267,265 @@ public Builder putAllParams(java.util.Map userLabels_; + + private com.google.protobuf.MapField + internalGetUserLabels() { + if (userLabels_ == null) { + return com.google.protobuf.MapField.emptyMapField( + UserLabelsDefaultEntryHolder.defaultEntry); + } + return userLabels_; + } + + private com.google.protobuf.MapField + internalGetMutableUserLabels() { + onChanged(); + ; + if (userLabels_ == null) { + userLabels_ = + com.google.protobuf.MapField.newMapField(UserLabelsDefaultEntryHolder.defaultEntry); + } + if (!userLabels_.isMutable()) { + userLabels_ = userLabels_.copy(); + } + return userLabels_; + } + + public int getUserLabelsCount() { + return internalGetUserLabels().getMap().size(); + } + /** + * + * + *
+     * The user labels applied to a resource must meet the following requirements:
+     * * Each resource can have multiple labels, up to a maximum of 64.
+     * * Each label must be a key-value pair.
+     * * Keys have a minimum length of 1 character and a maximum length of 63
+     *   characters and cannot be empty. Values can be empty and have a maximum
+     *   length of 63 characters.
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     *   underscores, and dashes. All characters must use UTF-8 encoding, and
+     *   international characters are allowed.
+     * * The key portion of a label must be unique. However, you can use the same
+     *   key with multiple resources.
+     * * Keys must start with a lowercase letter or international character.
+     * See [Google Cloud
+     * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+     * for more details.
+     * 
+ * + * map<string, string> user_labels = 8; + */ + @java.lang.Override + public boolean containsUserLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetUserLabels().getMap().containsKey(key); + } + /** Use {@link #getUserLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getUserLabels() { + return getUserLabelsMap(); + } + /** + * + * + *
+     * The user labels applied to a resource must meet the following requirements:
+     * * Each resource can have multiple labels, up to a maximum of 64.
+     * * Each label must be a key-value pair.
+     * * Keys have a minimum length of 1 character and a maximum length of 63
+     *   characters and cannot be empty. Values can be empty and have a maximum
+     *   length of 63 characters.
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     *   underscores, and dashes. All characters must use UTF-8 encoding, and
+     *   international characters are allowed.
+     * * The key portion of a label must be unique. However, you can use the same
+     *   key with multiple resources.
+     * * Keys must start with a lowercase letter or international character.
+     * See [Google Cloud
+     * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+     * for more details.
+     * 
+ * + * map<string, string> user_labels = 8; + */ + @java.lang.Override + public java.util.Map getUserLabelsMap() { + return internalGetUserLabels().getMap(); + } + /** + * + * + *
+     * The user labels applied to a resource must meet the following requirements:
+     * * Each resource can have multiple labels, up to a maximum of 64.
+     * * Each label must be a key-value pair.
+     * * Keys have a minimum length of 1 character and a maximum length of 63
+     *   characters and cannot be empty. Values can be empty and have a maximum
+     *   length of 63 characters.
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     *   underscores, and dashes. All characters must use UTF-8 encoding, and
+     *   international characters are allowed.
+     * * The key portion of a label must be unique. However, you can use the same
+     *   key with multiple resources.
+     * * Keys must start with a lowercase letter or international character.
+     * See [Google Cloud
+     * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+     * for more details.
+     * 
+ * + * map<string, string> user_labels = 8; + */ + @java.lang.Override + public java.lang.String getUserLabelsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetUserLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * The user labels applied to a resource must meet the following requirements:
+     * * Each resource can have multiple labels, up to a maximum of 64.
+     * * Each label must be a key-value pair.
+     * * Keys have a minimum length of 1 character and a maximum length of 63
+     *   characters and cannot be empty. Values can be empty and have a maximum
+     *   length of 63 characters.
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     *   underscores, and dashes. All characters must use UTF-8 encoding, and
+     *   international characters are allowed.
+     * * The key portion of a label must be unique. However, you can use the same
+     *   key with multiple resources.
+     * * Keys must start with a lowercase letter or international character.
+     * See [Google Cloud
+     * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+     * for more details.
+     * 
+ * + * map<string, string> user_labels = 8; + */ + @java.lang.Override + public java.lang.String getUserLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetUserLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearUserLabels() { + internalGetMutableUserLabels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * The user labels applied to a resource must meet the following requirements:
+     * * Each resource can have multiple labels, up to a maximum of 64.
+     * * Each label must be a key-value pair.
+     * * Keys have a minimum length of 1 character and a maximum length of 63
+     *   characters and cannot be empty. Values can be empty and have a maximum
+     *   length of 63 characters.
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     *   underscores, and dashes. All characters must use UTF-8 encoding, and
+     *   international characters are allowed.
+     * * The key portion of a label must be unique. However, you can use the same
+     *   key with multiple resources.
+     * * Keys must start with a lowercase letter or international character.
+     * See [Google Cloud
+     * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+     * for more details.
+     * 
+ * + * map<string, string> user_labels = 8; + */ + public Builder removeUserLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableUserLabels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableUserLabels() { + return internalGetMutableUserLabels().getMutableMap(); + } + /** + * + * + *
+     * The user labels applied to a resource must meet the following requirements:
+     * * Each resource can have multiple labels, up to a maximum of 64.
+     * * Each label must be a key-value pair.
+     * * Keys have a minimum length of 1 character and a maximum length of 63
+     *   characters and cannot be empty. Values can be empty and have a maximum
+     *   length of 63 characters.
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     *   underscores, and dashes. All characters must use UTF-8 encoding, and
+     *   international characters are allowed.
+     * * The key portion of a label must be unique. However, you can use the same
+     *   key with multiple resources.
+     * * Keys must start with a lowercase letter or international character.
+     * See [Google Cloud
+     * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+     * for more details.
+     * 
+ * + * map<string, string> user_labels = 8; + */ + public Builder putUserLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableUserLabels().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * The user labels applied to a resource must meet the following requirements:
+     * * Each resource can have multiple labels, up to a maximum of 64.
+     * * Each label must be a key-value pair.
+     * * Keys have a minimum length of 1 character and a maximum length of 63
+     *   characters and cannot be empty. Values can be empty and have a maximum
+     *   length of 63 characters.
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     *   underscores, and dashes. All characters must use UTF-8 encoding, and
+     *   international characters are allowed.
+     * * The key portion of a label must be unique. However, you can use the same
+     *   key with multiple resources.
+     * * Keys must start with a lowercase letter or international character.
+     * See [Google Cloud
+     * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+     * for more details.
+     * 
+ * + * map<string, string> user_labels = 8; + */ + public Builder putAllUserLabels(java.util.Map values) { + internalGetMutableUserLabels().getMutableMap().putAll(values); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendRequestOrBuilder.java b/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendRequestOrBuilder.java index 9857949c0612..845394507c37 100644 --- a/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendRequestOrBuilder.java +++ b/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendRequestOrBuilder.java @@ -385,4 +385,133 @@ com.google.protobuf.Value getParamsOrDefault( * map<string, .google.protobuf.Value> params = 6; */ com.google.protobuf.Value getParamsOrThrow(java.lang.String key); + + /** + * + * + *
+   * The user labels applied to a resource must meet the following requirements:
+   * * Each resource can have multiple labels, up to a maximum of 64.
+   * * Each label must be a key-value pair.
+   * * Keys have a minimum length of 1 character and a maximum length of 63
+   *   characters and cannot be empty. Values can be empty and have a maximum
+   *   length of 63 characters.
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   *   underscores, and dashes. All characters must use UTF-8 encoding, and
+   *   international characters are allowed.
+   * * The key portion of a label must be unique. However, you can use the same
+   *   key with multiple resources.
+   * * Keys must start with a lowercase letter or international character.
+   * See [Google Cloud
+   * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+   * for more details.
+   * 
+ * + * map<string, string> user_labels = 8; + */ + int getUserLabelsCount(); + /** + * + * + *
+   * The user labels applied to a resource must meet the following requirements:
+   * * Each resource can have multiple labels, up to a maximum of 64.
+   * * Each label must be a key-value pair.
+   * * Keys have a minimum length of 1 character and a maximum length of 63
+   *   characters and cannot be empty. Values can be empty and have a maximum
+   *   length of 63 characters.
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   *   underscores, and dashes. All characters must use UTF-8 encoding, and
+   *   international characters are allowed.
+   * * The key portion of a label must be unique. However, you can use the same
+   *   key with multiple resources.
+   * * Keys must start with a lowercase letter or international character.
+   * See [Google Cloud
+   * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+   * for more details.
+   * 
+ * + * map<string, string> user_labels = 8; + */ + boolean containsUserLabels(java.lang.String key); + /** Use {@link #getUserLabelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getUserLabels(); + /** + * + * + *
+   * The user labels applied to a resource must meet the following requirements:
+   * * Each resource can have multiple labels, up to a maximum of 64.
+   * * Each label must be a key-value pair.
+   * * Keys have a minimum length of 1 character and a maximum length of 63
+   *   characters and cannot be empty. Values can be empty and have a maximum
+   *   length of 63 characters.
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   *   underscores, and dashes. All characters must use UTF-8 encoding, and
+   *   international characters are allowed.
+   * * The key portion of a label must be unique. However, you can use the same
+   *   key with multiple resources.
+   * * Keys must start with a lowercase letter or international character.
+   * See [Google Cloud
+   * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+   * for more details.
+   * 
+ * + * map<string, string> user_labels = 8; + */ + java.util.Map getUserLabelsMap(); + /** + * + * + *
+   * The user labels applied to a resource must meet the following requirements:
+   * * Each resource can have multiple labels, up to a maximum of 64.
+   * * Each label must be a key-value pair.
+   * * Keys have a minimum length of 1 character and a maximum length of 63
+   *   characters and cannot be empty. Values can be empty and have a maximum
+   *   length of 63 characters.
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   *   underscores, and dashes. All characters must use UTF-8 encoding, and
+   *   international characters are allowed.
+   * * The key portion of a label must be unique. However, you can use the same
+   *   key with multiple resources.
+   * * Keys must start with a lowercase letter or international character.
+   * See [Google Cloud
+   * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+   * for more details.
+   * 
+ * + * map<string, string> user_labels = 8; + */ + + /* nullable */ + java.lang.String getUserLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * The user labels applied to a resource must meet the following requirements:
+   * * Each resource can have multiple labels, up to a maximum of 64.
+   * * Each label must be a key-value pair.
+   * * Keys have a minimum length of 1 character and a maximum length of 63
+   *   characters and cannot be empty. Values can be empty and have a maximum
+   *   length of 63 characters.
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   *   underscores, and dashes. All characters must use UTF-8 encoding, and
+   *   international characters are allowed.
+   * * The key portion of a label must be unique. However, you can use the same
+   *   key with multiple resources.
+   * * Keys must start with a lowercase letter or international character.
+   * See [Google Cloud
+   * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
+   * for more details.
+   * 
+ * + * map<string, string> user_labels = 8; + */ + java.lang.String getUserLabelsOrThrow(java.lang.String key); } diff --git a/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceProto.java b/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceProto.java index 1476a5789e49..ae7cc877553a 100644 --- a/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceProto.java +++ b/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/java/com/google/cloud/discoveryengine/v1beta/RecommendationServiceProto.java @@ -35,6 +35,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_discoveryengine_v1beta_RecommendRequest_ParamsEntry_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_discoveryengine_v1beta_RecommendRequest_ParamsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_discoveryengine_v1beta_RecommendRequest_UserLabelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_discoveryengine_v1beta_RecommendRequest_UserLabelsEntry_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_discoveryengine_v1beta_RecommendResponse_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -64,7 +68,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "api/resource.proto\0322google/cloud/discove" + "ryengine/v1beta/document.proto\0324google/c" + "loud/discoveryengine/v1beta/user_event.p" - + "roto\032\034google/protobuf/struct.proto\"\375\002\n\020R" + + "roto\032\034google/protobuf/struct.proto\"\214\004\n\020R" + "ecommendRequest\022L\n\016serving_config\030\001 \001(\tB" + "4\340A\002\372A.\n,discoveryengine.googleapis.com/" + "ServingConfig\022G\n\nuser_event\030\002 \001(\0132..goog" @@ -72,37 +76,40 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "tB\003\340A\002\022\021\n\tpage_size\030\003 \001(\005\022\016\n\006filter\030\004 \001(" + "\t\022\025\n\rvalidate_only\030\005 \001(\010\022Q\n\006params\030\006 \003(\013" + "2A.google.cloud.discoveryengine.v1beta.R" - + "ecommendRequest.ParamsEntry\032E\n\013ParamsEnt" - + "ry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026.google." - + "protobuf.Value:\0028\001\"\324\003\n\021RecommendResponse" - + "\022\\\n\007results\030\001 \003(\0132K.google.cloud.discove" - + "ryengine.v1beta.RecommendResponse.Recomm" - + "endationResult\022\031\n\021attribution_token\030\002 \001(" - + "\t\022\023\n\013missing_ids\030\003 \003(\t\022\025\n\rvalidate_only\030" - + "\004 \001(\010\032\231\002\n\024RecommendationResult\022\n\n\002id\030\001 \001" - + "(\t\022?\n\010document\030\002 \001(\0132-.google.cloud.disc" - + "overyengine.v1beta.Document\022k\n\010metadata\030" - + "\003 \003(\0132Y.google.cloud.discoveryengine.v1b" - + "eta.RecommendResponse.RecommendationResu" - + "lt.MetadataEntry\032G\n\rMetadataEntry\022\013\n\003key" - + "\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026.google.protobuf." - + "Value:\0028\0012\314\002\n\025RecommendationService\022\336\001\n\t" - + "Recommend\0225.google.cloud.discoveryengine" - + ".v1beta.RecommendRequest\0326.google.cloud." - + "discoveryengine.v1beta.RecommendResponse" - + "\"b\202\323\344\223\002\\\"W/v1beta/{serving_config=projec" - + "ts/*/locations/*/dataStores/*/servingCon" - + "figs/*}:recommend:\001*\032R\312A\036discoveryengine" - + ".googleapis.com\322A.https://www.googleapis" - + ".com/auth/cloud-platformB\242\002\n\'com.google." - + "cloud.discoveryengine.v1betaB\032Recommenda" - + "tionServiceProtoP\001ZRgoogle.golang.org/ge" - + "nproto/googleapis/cloud/discoveryengine/" - + "v1beta;discoveryengine\242\002\017DISCOVERYENGINE" - + "\252\002#Google.Cloud.DiscoveryEngine.V1Beta\312\002" - + "#Google\\Cloud\\DiscoveryEngine\\V1beta\352\002&G" - + "oogle::Cloud::DiscoveryEngine::V1betab\006p" - + "roto3" + + "ecommendRequest.ParamsEntry\022Z\n\013user_labe" + + "ls\030\010 \003(\0132E.google.cloud.discoveryengine." + + "v1beta.RecommendRequest.UserLabelsEntry\032" + + "E\n\013ParamsEntry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 \001" + + "(\0132\026.google.protobuf.Value:\0028\001\0321\n\017UserLa" + + "belsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028" + + "\001\"\324\003\n\021RecommendResponse\022\\\n\007results\030\001 \003(\013" + + "2K.google.cloud.discoveryengine.v1beta.R" + + "ecommendResponse.RecommendationResult\022\031\n" + + "\021attribution_token\030\002 \001(\t\022\023\n\013missing_ids\030" + + "\003 \003(\t\022\025\n\rvalidate_only\030\004 \001(\010\032\231\002\n\024Recomme" + + "ndationResult\022\n\n\002id\030\001 \001(\t\022?\n\010document\030\002 " + + "\001(\0132-.google.cloud.discoveryengine.v1bet" + + "a.Document\022k\n\010metadata\030\003 \003(\0132Y.google.cl" + + "oud.discoveryengine.v1beta.RecommendResp" + + "onse.RecommendationResult.MetadataEntry\032" + + "G\n\rMetadataEntry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002" + + " \001(\0132\026.google.protobuf.Value:\0028\0012\314\002\n\025Rec" + + "ommendationService\022\336\001\n\tRecommend\0225.googl" + + "e.cloud.discoveryengine.v1beta.Recommend" + + "Request\0326.google.cloud.discoveryengine.v" + + "1beta.RecommendResponse\"b\202\323\344\223\002\\\"W/v1beta" + + "/{serving_config=projects/*/locations/*/" + + "dataStores/*/servingConfigs/*}:recommend" + + ":\001*\032R\312A\036discoveryengine.googleapis.com\322A" + + ".https://www.googleapis.com/auth/cloud-p" + + "latformB\242\002\n\'com.google.cloud.discoveryen" + + "gine.v1betaB\032RecommendationServiceProtoP" + + "\001ZRgoogle.golang.org/genproto/googleapis" + + "/cloud/discoveryengine/v1beta;discoverye" + + "ngine\242\002\017DISCOVERYENGINE\252\002#Google.Cloud.D" + + "iscoveryEngine.V1Beta\312\002#Google\\Cloud\\Dis" + + "coveryEngine\\V1beta\352\002&Google::Cloud::Dis" + + "coveryEngine::V1betab\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -122,7 +129,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_discoveryengine_v1beta_RecommendRequest_descriptor, new java.lang.String[] { - "ServingConfig", "UserEvent", "PageSize", "Filter", "ValidateOnly", "Params", + "ServingConfig", + "UserEvent", + "PageSize", + "Filter", + "ValidateOnly", + "Params", + "UserLabels", }); internal_static_google_cloud_discoveryengine_v1beta_RecommendRequest_ParamsEntry_descriptor = internal_static_google_cloud_discoveryengine_v1beta_RecommendRequest_descriptor @@ -134,6 +147,16 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Key", "Value", }); + internal_static_google_cloud_discoveryengine_v1beta_RecommendRequest_UserLabelsEntry_descriptor = + internal_static_google_cloud_discoveryengine_v1beta_RecommendRequest_descriptor + .getNestedTypes() + .get(1); + internal_static_google_cloud_discoveryengine_v1beta_RecommendRequest_UserLabelsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_discoveryengine_v1beta_RecommendRequest_UserLabelsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); internal_static_google_cloud_discoveryengine_v1beta_RecommendResponse_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_google_cloud_discoveryengine_v1beta_RecommendResponse_fieldAccessorTable = diff --git a/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/proto/google/cloud/discoveryengine/v1beta/recommendation_service.proto b/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/proto/google/cloud/discoveryengine/v1beta/recommendation_service.proto index 8efe0df37480..14304006ad33 100644 --- a/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/proto/google/cloud/discoveryengine/v1beta/recommendation_service.proto +++ b/java-discoveryengine/proto-google-cloud-discoveryengine-v1beta/src/main/proto/google/cloud/discoveryengine/v1beta/recommendation_service.proto @@ -137,6 +137,25 @@ message RecommendRequest { // This gives request-level control and adjusts recommendation results // based on Document category. map params = 6; + + // The user labels applied to a resource must meet the following requirements: + // + // * Each resource can have multiple labels, up to a maximum of 64. + // * Each label must be a key-value pair. + // * Keys have a minimum length of 1 character and a maximum length of 63 + // characters and cannot be empty. Values can be empty and have a maximum + // length of 63 characters. + // * Keys and values can contain only lowercase letters, numeric characters, + // underscores, and dashes. All characters must use UTF-8 encoding, and + // international characters are allowed. + // * The key portion of a label must be unique. However, you can use the same + // key with multiple resources. + // * Keys must start with a lowercase letter or international character. + // + // See [Google Cloud + // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + // for more details. + map user_labels = 8; } // Response message for Recommend method.