Skip to content

Commit b6c0df2

Browse files
feat: [recommender] Add MarkRecommendationDismissed method (#9791)
* feat: Add MarkRecommendationDismissed method feat: Billing account scoped Recommender/InsightType config feat: Add Sustainability and Reliability impact PiperOrigin-RevId: 561374659 Source-Link: googleapis/googleapis@fa66938 Source-Link: https://github.com/googleapis/googleapis-gen/commit/aa0b3f367bbaeeb91a6903aec89a3399cc5ac8c5 Copy-Tag: eyJwIjoiamF2YS1yZWNvbW1lbmRlci8uT3dsQm90LnlhbWwiLCJoIjoiYWEwYjNmMzY3YmJhZWViOTFhNjkwM2FlYzg5YTMzOTljYzVhYzhjNSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a1b7cd8 commit b6c0df2

File tree

40 files changed

+5451
-319
lines changed

40 files changed

+5451
-319
lines changed

java-recommender/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
2020
<dependency>
2121
<groupId>com.google.cloud</groupId>
2222
<artifactId>libraries-bom</artifactId>
23-
<version>26.19.0</version>
23+
<version>26.22.0</version>
2424
<type>pom</type>
2525
<scope>import</scope>
2626
</dependency>
@@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
195195
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
196196
[stability-image]: https://img.shields.io/badge/stability-stable-green
197197
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-recommender.svg
198-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-recommender/2.23.0
198+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-recommender/2.25.0
199199
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
200200
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
201201
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/RecommenderClient.java

Lines changed: 94 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,82 @@ public final UnaryCallable<GetRecommendationRequest, Recommendation> getRecommen
12001200
return stub.getRecommendationCallable();
12011201
}
12021202

1203+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1204+
/**
1205+
* Mark the Recommendation State as Dismissed. Users can use this method to indicate to the
1206+
* Recommender API that an ACTIVE recommendation has to be marked back as DISMISSED.
1207+
*
1208+
* <p>MarkRecommendationDismissed can be applied to recommendations in ACTIVE state.
1209+
*
1210+
* <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1211+
*
1212+
* <p>Sample code:
1213+
*
1214+
* <pre>{@code
1215+
* // This snippet has been automatically generated and should be regarded as a code template only.
1216+
* // It will require modifications to work:
1217+
* // - It may require correct/in-range values for request initialization.
1218+
* // - It may require specifying regional endpoints when creating the service client as shown in
1219+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1220+
* try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1221+
* MarkRecommendationDismissedRequest request =
1222+
* MarkRecommendationDismissedRequest.newBuilder()
1223+
* .setName(
1224+
* RecommendationName.ofProjectLocationRecommenderRecommendationName(
1225+
* "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1226+
* .toString())
1227+
* .setEtag("etag3123477")
1228+
* .build();
1229+
* Recommendation response = recommenderClient.markRecommendationDismissed(request);
1230+
* }
1231+
* }</pre>
1232+
*
1233+
* @param request The request object containing all of the parameters for the API call.
1234+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1235+
*/
1236+
public final Recommendation markRecommendationDismissed(
1237+
MarkRecommendationDismissedRequest request) {
1238+
return markRecommendationDismissedCallable().call(request);
1239+
}
1240+
1241+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1242+
/**
1243+
* Mark the Recommendation State as Dismissed. Users can use this method to indicate to the
1244+
* Recommender API that an ACTIVE recommendation has to be marked back as DISMISSED.
1245+
*
1246+
* <p>MarkRecommendationDismissed can be applied to recommendations in ACTIVE state.
1247+
*
1248+
* <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1249+
*
1250+
* <p>Sample code:
1251+
*
1252+
* <pre>{@code
1253+
* // This snippet has been automatically generated and should be regarded as a code template only.
1254+
* // It will require modifications to work:
1255+
* // - It may require correct/in-range values for request initialization.
1256+
* // - It may require specifying regional endpoints when creating the service client as shown in
1257+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1258+
* try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1259+
* MarkRecommendationDismissedRequest request =
1260+
* MarkRecommendationDismissedRequest.newBuilder()
1261+
* .setName(
1262+
* RecommendationName.ofProjectLocationRecommenderRecommendationName(
1263+
* "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1264+
* .toString())
1265+
* .setEtag("etag3123477")
1266+
* .build();
1267+
* ApiFuture<Recommendation> future =
1268+
* recommenderClient.markRecommendationDismissedCallable().futureCall(request);
1269+
* // Do something.
1270+
* Recommendation response = future.get();
1271+
* }
1272+
* }</pre>
1273+
*/
1274+
public final UnaryCallable<MarkRecommendationDismissedRequest, Recommendation>
1275+
markRecommendationDismissedCallable() {
1276+
return stub.markRecommendationDismissedCallable();
1277+
}
1278+
12031279
// AUTO-GENERATED DOCUMENTATION AND METHOD.
12041280
/**
12051281
* Marks the Recommendation State as Claimed. Users can use this method to indicate to the
@@ -1779,6 +1855,9 @@ public final Recommendation markRecommendationFailed(MarkRecommendationFailedReq
17791855
* <ul>
17801856
* <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
17811857
* </ul>
1858+
* <ul>
1859+
* <li>`billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
1860+
* </ul>
17821861
*
17831862
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
17841863
*/
@@ -1823,6 +1902,9 @@ public final RecommenderConfig getRecommenderConfig(RecommenderConfigName name)
18231902
* <ul>
18241903
* <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
18251904
* </ul>
1905+
* <ul>
1906+
* <li>`billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
1907+
* </ul>
18261908
*
18271909
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
18281910
*/
@@ -2016,13 +2098,16 @@ public final RecommenderConfig updateRecommenderConfig(UpdateRecommenderConfigRe
20162098
* @param name Required. Name of the InsightTypeConfig to get.
20172099
* <p>Acceptable formats:
20182100
* <ul>
2019-
* <li>`projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
2101+
* <li>`projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
20202102
* </ul>
20212103
* <ul>
2022-
* <li>`projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
2104+
* <li>`projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
20232105
* </ul>
20242106
* <ul>
2025-
* <li>`organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
2107+
* <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
2108+
* </ul>
2109+
* <ul>
2110+
* <li>`billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
20262111
* </ul>
20272112
*
20282113
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -2060,13 +2145,16 @@ public final InsightTypeConfig getInsightTypeConfig(InsightTypeConfigName name)
20602145
* @param name Required. Name of the InsightTypeConfig to get.
20612146
* <p>Acceptable formats:
20622147
* <ul>
2063-
* <li>`projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
2148+
* <li>`projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
2149+
* </ul>
2150+
* <ul>
2151+
* <li>`projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
20642152
* </ul>
20652153
* <ul>
2066-
* <li>`projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
2154+
* <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
20672155
* </ul>
20682156
* <ul>
2069-
* <li>`organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
2157+
* <li>`billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
20702158
* </ul>
20712159
*
20722160
* @throws com.google.api.gax.rpc.ApiException if the remote call fails

java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/RecommenderSettings.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ public UnaryCallSettings<GetRecommendationRequest, Recommendation> getRecommenda
103103
return ((RecommenderStubSettings) getStubSettings()).getRecommendationSettings();
104104
}
105105

106+
/** Returns the object with the settings used for calls to markRecommendationDismissed. */
107+
public UnaryCallSettings<MarkRecommendationDismissedRequest, Recommendation>
108+
markRecommendationDismissedSettings() {
109+
return ((RecommenderStubSettings) getStubSettings()).markRecommendationDismissedSettings();
110+
}
111+
106112
/** Returns the object with the settings used for calls to markRecommendationClaimed. */
107113
public UnaryCallSettings<MarkRecommendationClaimedRequest, Recommendation>
108114
markRecommendationClaimedSettings() {
@@ -292,6 +298,12 @@ public UnaryCallSettings.Builder<GetInsightRequest, Insight> getInsightSettings(
292298
return getStubSettingsBuilder().getRecommendationSettings();
293299
}
294300

301+
/** Returns the builder for the settings used for calls to markRecommendationDismissed. */
302+
public UnaryCallSettings.Builder<MarkRecommendationDismissedRequest, Recommendation>
303+
markRecommendationDismissedSettings() {
304+
return getStubSettingsBuilder().markRecommendationDismissedSettings();
305+
}
306+
295307
/** Returns the builder for the settings used for calls to markRecommendationClaimed. */
296308
public UnaryCallSettings.Builder<MarkRecommendationClaimedRequest, Recommendation>
297309
markRecommendationClaimedSettings() {

java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/gapic_metadata.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
"MarkRecommendationClaimed": {
3535
"methods": ["markRecommendationClaimed", "markRecommendationClaimed", "markRecommendationClaimed", "markRecommendationClaimedCallable"]
3636
},
37+
"MarkRecommendationDismissed": {
38+
"methods": ["markRecommendationDismissed", "markRecommendationDismissedCallable"]
39+
},
3740
"MarkRecommendationFailed": {
3841
"methods": ["markRecommendationFailed", "markRecommendationFailed", "markRecommendationFailed", "markRecommendationFailedCallable"]
3942
},

java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/GrpcRecommenderStub.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import com.google.cloud.recommender.v1.ListRecommendationsResponse;
3939
import com.google.cloud.recommender.v1.MarkInsightAcceptedRequest;
4040
import com.google.cloud.recommender.v1.MarkRecommendationClaimedRequest;
41+
import com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest;
4142
import com.google.cloud.recommender.v1.MarkRecommendationFailedRequest;
4243
import com.google.cloud.recommender.v1.MarkRecommendationSucceededRequest;
4344
import com.google.cloud.recommender.v1.Recommendation;
@@ -108,6 +109,17 @@ public class GrpcRecommenderStub extends RecommenderStub {
108109
.setResponseMarshaller(ProtoUtils.marshaller(Recommendation.getDefaultInstance()))
109110
.build();
110111

112+
private static final MethodDescriptor<MarkRecommendationDismissedRequest, Recommendation>
113+
markRecommendationDismissedMethodDescriptor =
114+
MethodDescriptor.<MarkRecommendationDismissedRequest, Recommendation>newBuilder()
115+
.setType(MethodDescriptor.MethodType.UNARY)
116+
.setFullMethodName(
117+
"google.cloud.recommender.v1.Recommender/MarkRecommendationDismissed")
118+
.setRequestMarshaller(
119+
ProtoUtils.marshaller(MarkRecommendationDismissedRequest.getDefaultInstance()))
120+
.setResponseMarshaller(ProtoUtils.marshaller(Recommendation.getDefaultInstance()))
121+
.build();
122+
111123
private static final MethodDescriptor<MarkRecommendationClaimedRequest, Recommendation>
112124
markRecommendationClaimedMethodDescriptor =
113125
MethodDescriptor.<MarkRecommendationClaimedRequest, Recommendation>newBuilder()
@@ -190,6 +202,8 @@ public class GrpcRecommenderStub extends RecommenderStub {
190202
private final UnaryCallable<ListRecommendationsRequest, ListRecommendationsPagedResponse>
191203
listRecommendationsPagedCallable;
192204
private final UnaryCallable<GetRecommendationRequest, Recommendation> getRecommendationCallable;
205+
private final UnaryCallable<MarkRecommendationDismissedRequest, Recommendation>
206+
markRecommendationDismissedCallable;
193207
private final UnaryCallable<MarkRecommendationClaimedRequest, Recommendation>
194208
markRecommendationClaimedCallable;
195209
private final UnaryCallable<MarkRecommendationSucceededRequest, Recommendation>
@@ -298,6 +312,17 @@ protected GrpcRecommenderStub(
298312
return builder.build();
299313
})
300314
.build();
315+
GrpcCallSettings<MarkRecommendationDismissedRequest, Recommendation>
316+
markRecommendationDismissedTransportSettings =
317+
GrpcCallSettings.<MarkRecommendationDismissedRequest, Recommendation>newBuilder()
318+
.setMethodDescriptor(markRecommendationDismissedMethodDescriptor)
319+
.setParamsExtractor(
320+
request -> {
321+
RequestParamsBuilder builder = RequestParamsBuilder.create();
322+
builder.add("name", String.valueOf(request.getName()));
323+
return builder.build();
324+
})
325+
.build();
301326
GrpcCallSettings<MarkRecommendationClaimedRequest, Recommendation>
302327
markRecommendationClaimedTransportSettings =
303328
GrpcCallSettings.<MarkRecommendationClaimedRequest, Recommendation>newBuilder()
@@ -409,6 +434,11 @@ protected GrpcRecommenderStub(
409434
getRecommendationTransportSettings,
410435
settings.getRecommendationSettings(),
411436
clientContext);
437+
this.markRecommendationDismissedCallable =
438+
callableFactory.createUnaryCallable(
439+
markRecommendationDismissedTransportSettings,
440+
settings.markRecommendationDismissedSettings(),
441+
clientContext);
412442
this.markRecommendationClaimedCallable =
413443
callableFactory.createUnaryCallable(
414444
markRecommendationClaimedTransportSettings,
@@ -490,6 +520,12 @@ public UnaryCallable<GetRecommendationRequest, Recommendation> getRecommendation
490520
return getRecommendationCallable;
491521
}
492522

523+
@Override
524+
public UnaryCallable<MarkRecommendationDismissedRequest, Recommendation>
525+
markRecommendationDismissedCallable() {
526+
return markRecommendationDismissedCallable;
527+
}
528+
493529
@Override
494530
public UnaryCallable<MarkRecommendationClaimedRequest, Recommendation>
495531
markRecommendationClaimedCallable() {

0 commit comments

Comments
 (0)