Skip to content

Commit e63bf28

Browse files
yoshi-automationchingor13
authored andcommitted
fix!: operation value is now a one-of path_value (#41)
* [CHANGE ME] Re-generated to pick up changes in the API or client library generator. * chore: allow breaking proto interface changes * chore: allow breaking changes
0 parents  commit e63bf28

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright 2019 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
// DO NOT EDIT! This is a generated sample ("RequestPaged", "sample_list_recommendations")
17+
// sample-metadata:
18+
// title: List Recommendations
19+
// description: List recommendations for a specified project, location, and recommender.
20+
// usage: gradle run
21+
// -PmainClass=com.google.cloud.examples.recommender.v1beta1.SampleListRecommendations
22+
23+
package com.google.cloud.examples.recommender.v1beta1;
24+
25+
import com.google.cloud.recommender.v1beta1.ListRecommendationsRequest;
26+
import com.google.cloud.recommender.v1beta1.Recommendation;
27+
import com.google.cloud.recommender.v1beta1.RecommenderClient;
28+
29+
public class SampleListRecommendations {
30+
// [START ]
31+
/*
32+
* Please include the following imports to run this sample.
33+
*
34+
* import com.google.cloud.recommender.v1beta1.ListRecommendationsRequest;
35+
* import com.google.cloud.recommender.v1beta1.Recommendation;
36+
* import com.google.cloud.recommender.v1beta1.RecommenderClient;
37+
*/
38+
39+
/** List recommendations for a specified project, location, and recommender. */
40+
public static void sampleListRecommendations() {
41+
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
42+
String formattedParent =
43+
RecommenderClient.formatRecommenderName("[PROJECT]", "[LOCATION]", "[RECOMMENDER]");
44+
ListRecommendationsRequest request =
45+
ListRecommendationsRequest.newBuilder().setParent(formattedParent).build();
46+
for (Recommendation responseItem :
47+
recommenderClient.listRecommendations(request).iterateAll()) {
48+
Recommendation recommendation = responseItem;
49+
System.out.printf("Recommendation name: %s\n", recommendation.getName());
50+
System.out.printf("- description: %s\n", recommendation.getDescription());
51+
System.out.printf(
52+
"- primary_impact.category: %s\n", recommendation.getPrimaryImpact().getCategory());
53+
System.out.printf("- state_info.state: %s\n", recommendation.getStateInfo().getState());
54+
System.out.printf("- last_refresh_time: %s\n", recommendation.getLastRefreshTime());
55+
}
56+
} catch (Exception exception) {
57+
System.err.println("Failed to create the client due to: " + exception);
58+
}
59+
}
60+
// [END ]
61+
62+
public static void main(String[] args) {
63+
sampleListRecommendations();
64+
}
65+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
type: manifest/samples
3+
schema_version: 3
4+
java: &java
5+
environment: "java"
6+
bin: "mvn exec:java"
7+
base_path: "samples/src/main/java/com/google/cloud/examples/recommender/v1beta1"
8+
package: "com.google.cloud.examples.recommender.v1beta1"
9+
invocation: "{bin} -Dexec.mainClass={class} -Dexec.args='@args'"
10+
samples:
11+
- <<: *java
12+
sample: "sample_list_recommendations"
13+
path: "{base_path}/SampleListRecommendations.java"
14+
class: "{package}.SampleListRecommendations"
15+
region_tag: ""

0 commit comments

Comments
 (0)