3131import com .google .common .util .concurrent .MoreExecutors ;
3232import java .io .IOException ;
3333import java .util .List ;
34+ import java .util .Map ;
3435import java .util .concurrent .TimeUnit ;
3536import javax .annotation .Generated ;
3637
3738// AUTO-GENERATED DOCUMENTATION AND SERVICE
3839/**
39- * Service Description: Provides recommendations for cloud customers for various categories like
40- * performance optimization, cost savings, reliability, feature discovery, etc. These
41- * recommendations are generated automatically based on analysis of user resources, configuration
42- * and monitoring metrics.
40+ * Service Description: Provides insights and recommendations for cloud customers for various
41+ * categories like performance optimization, cost savings, reliability, feature discovery, etc.
42+ * Insights and recommendations are generated automatically based on analysis of user resources,
43+ * configuration and monitoring metrics.
4344 *
4445 * <p>This class provides the ability to make remote calls to the backing service through method
4546 * calls that map to API methods. Sample code to get started:
@@ -279,7 +280,8 @@ public RecommenderStub getStub() {
279280 * <pre><code>
280281 * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
281282 * String formattedParent = RecommenderClient.formatRecommenderName("[PROJECT]", "[LOCATION]", "[RECOMMENDER]");
282- * for (Recommendation element : recommenderClient.listRecommendations(formattedParent).iterateAll()) {
283+ * String filter = "";
284+ * for (Recommendation element : recommenderClient.listRecommendations(formattedParent, filter).iterateAll()) {
283285 * // doThingsWith(element);
284286 * }
285287 * }
@@ -289,12 +291,14 @@ public RecommenderStub getStub() {
289291 * formats:
290292 * <p>1. "projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]",
291293 * <p>LOCATION here refers to GCP Locations: https://cloud.google.com/about/locations/
294+ * @param filter Filter expression to restrict the recommendations returned. Supported filter
295+ * fields: state_info.state Eg: `state_info.state:"DISMISSED" or state_info.state:"FAILED"
292296 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
293297 */
294- public final ListRecommendationsPagedResponse listRecommendations (String parent ) {
298+ public final ListRecommendationsPagedResponse listRecommendations (String parent , String filter ) {
295299 RECOMMENDER_PATH_TEMPLATE .validate (parent , "listRecommendations" );
296300 ListRecommendationsRequest request =
297- ListRecommendationsRequest .newBuilder ().setParent (parent ).build ();
301+ ListRecommendationsRequest .newBuilder ().setParent (parent ).setFilter ( filter ). build ();
298302 return listRecommendations (request );
299303 }
300304
@@ -456,12 +460,12 @@ public final UnaryCallable<GetRecommendationRequest, Recommendation> getRecommen
456460
457461 // AUTO-GENERATED DOCUMENTATION AND METHOD
458462 /**
459- * Mark the Recommendation State as Claimed. Users can use this method to indicate to the
463+ * Marks the Recommendation State as Claimed. Users can use this method to indicate to the
460464 * Recommender API that they are starting to apply the recommendation themselves. This stops the
461- * recommendation content from being updated.
465+ * recommendation content from being updated. Associated insights are frozen and placed in the
466+ * ACCEPTED state.
462467 *
463- * <p>MarkRecommendationClaimed can be applied to recommendations in CLAIMED, SUCCEEDED, FAILED,
464- * or ACTIVE state.
468+ * <p>MarkRecommendationClaimed can be applied to recommendations in CLAIMED or ACTIVE state.
465469 *
466470 * <p>Requires the recommender.*.update IAM permission for the specified recommender.
467471 *
@@ -470,30 +474,38 @@ public final UnaryCallable<GetRecommendationRequest, Recommendation> getRecommen
470474 * <pre><code>
471475 * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
472476 * String formattedName = RecommenderClient.formatRecommendationName("[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
477+ * Map<String, String> stateMetadata = new HashMap<>();
473478 * String etag = "";
474- * Recommendation response = recommenderClient.markRecommendationClaimed(formattedName, etag);
479+ * Recommendation response = recommenderClient.markRecommendationClaimed(formattedName, stateMetadata, etag);
475480 * }
476481 * </code></pre>
477482 *
478483 * @param name Name of the recommendation.
484+ * @param stateMetadata State properties to include with this state. Overwrites any existing
485+ * `state_metadata`.
479486 * @param etag Fingerprint of the Recommendation. Provides optimistic locking.
480487 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
481488 */
482- public final Recommendation markRecommendationClaimed (String name , String etag ) {
489+ public final Recommendation markRecommendationClaimed (
490+ String name , Map <String , String > stateMetadata , String etag ) {
483491 RECOMMENDATION_PATH_TEMPLATE .validate (name , "markRecommendationClaimed" );
484492 MarkRecommendationClaimedRequest request =
485- MarkRecommendationClaimedRequest .newBuilder ().setName (name ).setEtag (etag ).build ();
493+ MarkRecommendationClaimedRequest .newBuilder ()
494+ .setName (name )
495+ .putAllStateMetadata (stateMetadata )
496+ .setEtag (etag )
497+ .build ();
486498 return markRecommendationClaimed (request );
487499 }
488500
489501 // AUTO-GENERATED DOCUMENTATION AND METHOD
490502 /**
491- * Mark the Recommendation State as Claimed. Users can use this method to indicate to the
503+ * Marks the Recommendation State as Claimed. Users can use this method to indicate to the
492504 * Recommender API that they are starting to apply the recommendation themselves. This stops the
493- * recommendation content from being updated.
505+ * recommendation content from being updated. Associated insights are frozen and placed in the
506+ * ACCEPTED state.
494507 *
495- * <p>MarkRecommendationClaimed can be applied to recommendations in CLAIMED, SUCCEEDED, FAILED,
496- * or ACTIVE state.
508+ * <p>MarkRecommendationClaimed can be applied to recommendations in CLAIMED or ACTIVE state.
497509 *
498510 * <p>Requires the recommender.*.update IAM permission for the specified recommender.
499511 *
@@ -520,12 +532,12 @@ public final Recommendation markRecommendationClaimed(MarkRecommendationClaimedR
520532
521533 // AUTO-GENERATED DOCUMENTATION AND METHOD
522534 /**
523- * Mark the Recommendation State as Claimed. Users can use this method to indicate to the
535+ * Marks the Recommendation State as Claimed. Users can use this method to indicate to the
524536 * Recommender API that they are starting to apply the recommendation themselves. This stops the
525- * recommendation content from being updated.
537+ * recommendation content from being updated. Associated insights are frozen and placed in the
538+ * ACCEPTED state.
526539 *
527- * <p>MarkRecommendationClaimed can be applied to recommendations in CLAIMED, SUCCEEDED, FAILED,
528- * or ACTIVE state.
540+ * <p>MarkRecommendationClaimed can be applied to recommendations in CLAIMED or ACTIVE state.
529541 *
530542 * <p>Requires the recommender.*.update IAM permission for the specified recommender.
531543 *
@@ -552,9 +564,10 @@ public final Recommendation markRecommendationClaimed(MarkRecommendationClaimedR
552564
553565 // AUTO-GENERATED DOCUMENTATION AND METHOD
554566 /**
555- * Mark the Recommendation State as Succeeded. Users can use this method to indicate to the
567+ * Marks the Recommendation State as Succeeded. Users can use this method to indicate to the
556568 * Recommender API that they have applied the recommendation themselves, and the operation was
557- * successful. This stops the recommendation content from being updated.
569+ * successful. This stops the recommendation content from being updated. Associated insights are
570+ * frozen and placed in the ACCEPTED state.
558571 *
559572 * <p>MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED,
560573 * or FAILED state.
@@ -566,27 +579,36 @@ public final Recommendation markRecommendationClaimed(MarkRecommendationClaimedR
566579 * <pre><code>
567580 * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
568581 * String formattedName = RecommenderClient.formatRecommendationName("[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
582+ * Map<String, String> stateMetadata = new HashMap<>();
569583 * String etag = "";
570- * Recommendation response = recommenderClient.markRecommendationSucceeded(formattedName, etag);
584+ * Recommendation response = recommenderClient.markRecommendationSucceeded(formattedName, stateMetadata, etag);
571585 * }
572586 * </code></pre>
573587 *
574588 * @param name Name of the recommendation.
589+ * @param stateMetadata State properties to include with this state. Overwrites any existing
590+ * `state_metadata`.
575591 * @param etag Fingerprint of the Recommendation. Provides optimistic locking.
576592 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
577593 */
578- public final Recommendation markRecommendationSucceeded (String name , String etag ) {
594+ public final Recommendation markRecommendationSucceeded (
595+ String name , Map <String , String > stateMetadata , String etag ) {
579596 RECOMMENDATION_PATH_TEMPLATE .validate (name , "markRecommendationSucceeded" );
580597 MarkRecommendationSucceededRequest request =
581- MarkRecommendationSucceededRequest .newBuilder ().setName (name ).setEtag (etag ).build ();
598+ MarkRecommendationSucceededRequest .newBuilder ()
599+ .setName (name )
600+ .putAllStateMetadata (stateMetadata )
601+ .setEtag (etag )
602+ .build ();
582603 return markRecommendationSucceeded (request );
583604 }
584605
585606 // AUTO-GENERATED DOCUMENTATION AND METHOD
586607 /**
587- * Mark the Recommendation State as Succeeded. Users can use this method to indicate to the
608+ * Marks the Recommendation State as Succeeded. Users can use this method to indicate to the
588609 * Recommender API that they have applied the recommendation themselves, and the operation was
589- * successful. This stops the recommendation content from being updated.
610+ * successful. This stops the recommendation content from being updated. Associated insights are
611+ * frozen and placed in the ACCEPTED state.
590612 *
591613 * <p>MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED,
592614 * or FAILED state.
@@ -617,9 +639,10 @@ public final Recommendation markRecommendationSucceeded(
617639
618640 // AUTO-GENERATED DOCUMENTATION AND METHOD
619641 /**
620- * Mark the Recommendation State as Succeeded. Users can use this method to indicate to the
642+ * Marks the Recommendation State as Succeeded. Users can use this method to indicate to the
621643 * Recommender API that they have applied the recommendation themselves, and the operation was
622- * successful. This stops the recommendation content from being updated.
644+ * successful. This stops the recommendation content from being updated. Associated insights are
645+ * frozen and placed in the ACCEPTED state.
623646 *
624647 * <p>MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED,
625648 * or FAILED state.
@@ -649,9 +672,10 @@ public final Recommendation markRecommendationSucceeded(
649672
650673 // AUTO-GENERATED DOCUMENTATION AND METHOD
651674 /**
652- * Mark the Recommendation State as Failed. Users can use this method to indicate to the
675+ * Marks the Recommendation State as Failed. Users can use this method to indicate to the
653676 * Recommender API that they have applied the recommendation themselves, and the operation failed.
654- * This stops the recommendation content from being updated.
677+ * This stops the recommendation content from being updated. Associated insights are frozen and
678+ * placed in the ACCEPTED state.
655679 *
656680 * <p>MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or
657681 * FAILED state.
@@ -663,27 +687,36 @@ public final Recommendation markRecommendationSucceeded(
663687 * <pre><code>
664688 * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
665689 * String formattedName = RecommenderClient.formatRecommendationName("[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
690+ * Map<String, String> stateMetadata = new HashMap<>();
666691 * String etag = "";
667- * Recommendation response = recommenderClient.markRecommendationFailed(formattedName, etag);
692+ * Recommendation response = recommenderClient.markRecommendationFailed(formattedName, stateMetadata, etag);
668693 * }
669694 * </code></pre>
670695 *
671696 * @param name Name of the recommendation.
697+ * @param stateMetadata State properties to include with this state. Overwrites any existing
698+ * `state_metadata`.
672699 * @param etag Fingerprint of the Recommendation. Provides optimistic locking.
673700 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
674701 */
675- public final Recommendation markRecommendationFailed (String name , String etag ) {
702+ public final Recommendation markRecommendationFailed (
703+ String name , Map <String , String > stateMetadata , String etag ) {
676704 RECOMMENDATION_PATH_TEMPLATE .validate (name , "markRecommendationFailed" );
677705 MarkRecommendationFailedRequest request =
678- MarkRecommendationFailedRequest .newBuilder ().setName (name ).setEtag (etag ).build ();
706+ MarkRecommendationFailedRequest .newBuilder ()
707+ .setName (name )
708+ .putAllStateMetadata (stateMetadata )
709+ .setEtag (etag )
710+ .build ();
679711 return markRecommendationFailed (request );
680712 }
681713
682714 // AUTO-GENERATED DOCUMENTATION AND METHOD
683715 /**
684- * Mark the Recommendation State as Failed. Users can use this method to indicate to the
716+ * Marks the Recommendation State as Failed. Users can use this method to indicate to the
685717 * Recommender API that they have applied the recommendation themselves, and the operation failed.
686- * This stops the recommendation content from being updated.
718+ * This stops the recommendation content from being updated. Associated insights are frozen and
719+ * placed in the ACCEPTED state.
687720 *
688721 * <p>MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or
689722 * FAILED state.
@@ -713,9 +746,10 @@ public final Recommendation markRecommendationFailed(MarkRecommendationFailedReq
713746
714747 // AUTO-GENERATED DOCUMENTATION AND METHOD
715748 /**
716- * Mark the Recommendation State as Failed. Users can use this method to indicate to the
749+ * Marks the Recommendation State as Failed. Users can use this method to indicate to the
717750 * Recommender API that they have applied the recommendation themselves, and the operation failed.
718- * This stops the recommendation content from being updated.
751+ * This stops the recommendation content from being updated. Associated insights are frozen and
752+ * placed in the ACCEPTED state.
719753 *
720754 * <p>MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or
721755 * FAILED state.
0 commit comments