Skip to content

Commit

Permalink
feat!: use RecommendationName, remove deprecated recommendation name …
Browse files Browse the repository at this point in the history
…helper methods (#79)

* [CHANGE ME] Re-generated  to pick up changes in the API or client library generator.

* allow removal of deprecated methods

Co-authored-by: Jeff Ching <[email protected]>
  • Loading branch information
yoshi-automation and chingor13 committed Jan 27, 2020
1 parent e63bf28 commit d4249bb
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 Google LLC
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,6 +25,7 @@
import com.google.cloud.recommender.v1beta1.ListRecommendationsRequest;
import com.google.cloud.recommender.v1beta1.Recommendation;
import com.google.cloud.recommender.v1beta1.RecommenderClient;
import com.google.cloud.recommender.v1beta1.RecommenderName;

public class SampleListRecommendations {
// [START ]
Expand All @@ -34,15 +35,15 @@ public class SampleListRecommendations {
* import com.google.cloud.recommender.v1beta1.ListRecommendationsRequest;
* import com.google.cloud.recommender.v1beta1.Recommendation;
* import com.google.cloud.recommender.v1beta1.RecommenderClient;
* import com.google.cloud.recommender.v1beta1.RecommenderName;
*/

/** List recommendations for a specified project, location, and recommender. */
public static void sampleListRecommendations() {
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
String formattedParent =
RecommenderClient.formatRecommenderName("[PROJECT]", "[LOCATION]", "[RECOMMENDER]");
RecommenderName parent = RecommenderName.of("[PROJECT]", "[LOCATION]", "[RECOMMENDER]");
ListRecommendationsRequest request =
ListRecommendationsRequest.newBuilder().setParent(formattedParent).build();
ListRecommendationsRequest.newBuilder().setParent(parent.toString()).build();
for (Recommendation responseItem :
recommenderClient.listRecommendations(request).iterateAll()) {
Recommendation recommendation = responseItem;
Expand Down

0 comments on commit d4249bb

Please sign in to comment.