• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 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 
17 package com.google.cloud.recommender.v1beta1;
18 
19 import com.google.api.core.ApiFuture;
20 import com.google.api.core.ApiFutures;
21 import com.google.api.core.BetaApi;
22 import com.google.api.gax.core.BackgroundResource;
23 import com.google.api.gax.paging.AbstractFixedSizeCollection;
24 import com.google.api.gax.paging.AbstractPage;
25 import com.google.api.gax.paging.AbstractPagedListResponse;
26 import com.google.api.gax.rpc.PageContext;
27 import com.google.api.gax.rpc.UnaryCallable;
28 import com.google.cloud.recommender.v1beta1.stub.RecommenderStub;
29 import com.google.cloud.recommender.v1beta1.stub.RecommenderStubSettings;
30 import com.google.common.util.concurrent.MoreExecutors;
31 import com.google.protobuf.FieldMask;
32 import java.io.IOException;
33 import java.util.List;
34 import java.util.Map;
35 import java.util.concurrent.TimeUnit;
36 import javax.annotation.Generated;
37 
38 // AUTO-GENERATED DOCUMENTATION AND CLASS.
39 /**
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.
44  *
45  * <p>This class provides the ability to make remote calls to the backing service through method
46  * calls that map to API methods. Sample code to get started:
47  *
48  * <pre>{@code
49  * // This snippet has been automatically generated and should be regarded as a code template only.
50  * // It will require modifications to work:
51  * // - It may require correct/in-range values for request initialization.
52  * // - It may require specifying regional endpoints when creating the service client as shown in
53  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
54  * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
55  *   InsightName name =
56  *       InsightName.ofProjectLocationInsightTypeInsightName(
57  *           "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]");
58  *   Insight response = recommenderClient.getInsight(name);
59  * }
60  * }</pre>
61  *
62  * <p>Note: close() needs to be called on the RecommenderClient object to clean up resources such as
63  * threads. In the example above, try-with-resources is used, which automatically calls close().
64  *
65  * <p>The surface of this class includes several types of Java methods for each of the API's
66  * methods:
67  *
68  * <ol>
69  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
70  *       converted into function parameters. It may be the case that not all fields are available as
71  *       parameters, and not every API method will have a flattened method entry point.
72  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
73  *       which must be constructed before the call. Not every API method will have a request object
74  *       method.
75  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
76  *       callable object, which can be used to initiate calls to the service.
77  * </ol>
78  *
79  * <p>See the individual methods for example code.
80  *
81  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
82  * these names, this class includes a format method for each type of name, and additionally a parse
83  * method to extract the individual identifiers contained within names that are returned.
84  *
85  * <p>This class can be customized by passing in a custom instance of RecommenderSettings to
86  * create(). For example:
87  *
88  * <p>To customize credentials:
89  *
90  * <pre>{@code
91  * // This snippet has been automatically generated and should be regarded as a code template only.
92  * // It will require modifications to work:
93  * // - It may require correct/in-range values for request initialization.
94  * // - It may require specifying regional endpoints when creating the service client as shown in
95  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
96  * RecommenderSettings recommenderSettings =
97  *     RecommenderSettings.newBuilder()
98  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
99  *         .build();
100  * RecommenderClient recommenderClient = RecommenderClient.create(recommenderSettings);
101  * }</pre>
102  *
103  * <p>To customize the endpoint:
104  *
105  * <pre>{@code
106  * // This snippet has been automatically generated and should be regarded as a code template only.
107  * // It will require modifications to work:
108  * // - It may require correct/in-range values for request initialization.
109  * // - It may require specifying regional endpoints when creating the service client as shown in
110  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
111  * RecommenderSettings recommenderSettings =
112  *     RecommenderSettings.newBuilder().setEndpoint(myEndpoint).build();
113  * RecommenderClient recommenderClient = RecommenderClient.create(recommenderSettings);
114  * }</pre>
115  *
116  * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
117  * the wire:
118  *
119  * <pre>{@code
120  * // This snippet has been automatically generated and should be regarded as a code template only.
121  * // It will require modifications to work:
122  * // - It may require correct/in-range values for request initialization.
123  * // - It may require specifying regional endpoints when creating the service client as shown in
124  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
125  * RecommenderSettings recommenderSettings = RecommenderSettings.newHttpJsonBuilder().build();
126  * RecommenderClient recommenderClient = RecommenderClient.create(recommenderSettings);
127  * }</pre>
128  *
129  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
130  */
131 @BetaApi
132 @Generated("by gapic-generator-java")
133 public class RecommenderClient implements BackgroundResource {
134   private final RecommenderSettings settings;
135   private final RecommenderStub stub;
136 
137   /** Constructs an instance of RecommenderClient with default settings. */
create()138   public static final RecommenderClient create() throws IOException {
139     return create(RecommenderSettings.newBuilder().build());
140   }
141 
142   /**
143    * Constructs an instance of RecommenderClient, using the given settings. The channels are created
144    * based on the settings passed in, or defaults for any settings that are not set.
145    */
create(RecommenderSettings settings)146   public static final RecommenderClient create(RecommenderSettings settings) throws IOException {
147     return new RecommenderClient(settings);
148   }
149 
150   /**
151    * Constructs an instance of RecommenderClient, using the given stub for making calls. This is for
152    * advanced usage - prefer using create(RecommenderSettings).
153    */
create(RecommenderStub stub)154   public static final RecommenderClient create(RecommenderStub stub) {
155     return new RecommenderClient(stub);
156   }
157 
158   /**
159    * Constructs an instance of RecommenderClient, using the given settings. This is protected so
160    * that it is easy to make a subclass, but otherwise, the static factory methods should be
161    * preferred.
162    */
RecommenderClient(RecommenderSettings settings)163   protected RecommenderClient(RecommenderSettings settings) throws IOException {
164     this.settings = settings;
165     this.stub = ((RecommenderStubSettings) settings.getStubSettings()).createStub();
166   }
167 
RecommenderClient(RecommenderStub stub)168   protected RecommenderClient(RecommenderStub stub) {
169     this.settings = null;
170     this.stub = stub;
171   }
172 
getSettings()173   public final RecommenderSettings getSettings() {
174     return settings;
175   }
176 
getStub()177   public RecommenderStub getStub() {
178     return stub;
179   }
180 
181   // AUTO-GENERATED DOCUMENTATION AND METHOD.
182   /**
183    * Lists insights for the specified Cloud Resource. Requires the recommender.&#42;.list IAM
184    * permission for the specified insight type.
185    *
186    * <p>Sample code:
187    *
188    * <pre>{@code
189    * // This snippet has been automatically generated and should be regarded as a code template only.
190    * // It will require modifications to work:
191    * // - It may require correct/in-range values for request initialization.
192    * // - It may require specifying regional endpoints when creating the service client as shown in
193    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
194    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
195    *   InsightTypeName parent =
196    *       InsightTypeName.ofProjectLocationInsightTypeName(
197    *           "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]");
198    *   for (Insight element : recommenderClient.listInsights(parent).iterateAll()) {
199    *     // doThingsWith(element);
200    *   }
201    * }
202    * }</pre>
203    *
204    * @param parent Required. The container resource on which to execute the request. Acceptable
205    *     formats:
206    *     <ul>
207    *       <li>`projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
208    *     </ul>
209    *     <ul>
210    *       <li>`projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
211    *     </ul>
212    *     <ul>
213    *       <li>`billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
214    *     </ul>
215    *     <ul>
216    *       <li>`folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
217    *     </ul>
218    *     <ul>
219    *       <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
220    *     </ul>
221    *     <p>LOCATION here refers to GCP Locations: https://cloud.google.com/about/locations/
222    *     INSIGHT_TYPE_ID refers to supported insight types:
223    *     https://cloud.google.com/recommender/docs/insights/insight-types.
224    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
225    */
listInsights(InsightTypeName parent)226   public final ListInsightsPagedResponse listInsights(InsightTypeName parent) {
227     ListInsightsRequest request =
228         ListInsightsRequest.newBuilder()
229             .setParent(parent == null ? null : parent.toString())
230             .build();
231     return listInsights(request);
232   }
233 
234   // AUTO-GENERATED DOCUMENTATION AND METHOD.
235   /**
236    * Lists insights for the specified Cloud Resource. Requires the recommender.&#42;.list IAM
237    * permission for the specified insight type.
238    *
239    * <p>Sample code:
240    *
241    * <pre>{@code
242    * // This snippet has been automatically generated and should be regarded as a code template only.
243    * // It will require modifications to work:
244    * // - It may require correct/in-range values for request initialization.
245    * // - It may require specifying regional endpoints when creating the service client as shown in
246    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
247    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
248    *   String parent =
249    *       InsightTypeName.ofProjectLocationInsightTypeName(
250    *               "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]")
251    *           .toString();
252    *   for (Insight element : recommenderClient.listInsights(parent).iterateAll()) {
253    *     // doThingsWith(element);
254    *   }
255    * }
256    * }</pre>
257    *
258    * @param parent Required. The container resource on which to execute the request. Acceptable
259    *     formats:
260    *     <ul>
261    *       <li>`projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
262    *     </ul>
263    *     <ul>
264    *       <li>`projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
265    *     </ul>
266    *     <ul>
267    *       <li>`billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
268    *     </ul>
269    *     <ul>
270    *       <li>`folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
271    *     </ul>
272    *     <ul>
273    *       <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
274    *     </ul>
275    *     <p>LOCATION here refers to GCP Locations: https://cloud.google.com/about/locations/
276    *     INSIGHT_TYPE_ID refers to supported insight types:
277    *     https://cloud.google.com/recommender/docs/insights/insight-types.
278    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
279    */
listInsights(String parent)280   public final ListInsightsPagedResponse listInsights(String parent) {
281     ListInsightsRequest request = ListInsightsRequest.newBuilder().setParent(parent).build();
282     return listInsights(request);
283   }
284 
285   // AUTO-GENERATED DOCUMENTATION AND METHOD.
286   /**
287    * Lists insights for the specified Cloud Resource. Requires the recommender.&#42;.list IAM
288    * permission for the specified insight type.
289    *
290    * <p>Sample code:
291    *
292    * <pre>{@code
293    * // This snippet has been automatically generated and should be regarded as a code template only.
294    * // It will require modifications to work:
295    * // - It may require correct/in-range values for request initialization.
296    * // - It may require specifying regional endpoints when creating the service client as shown in
297    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
298    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
299    *   ListInsightsRequest request =
300    *       ListInsightsRequest.newBuilder()
301    *           .setParent(
302    *               InsightTypeName.ofProjectLocationInsightTypeName(
303    *                       "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]")
304    *                   .toString())
305    *           .setPageSize(883849137)
306    *           .setPageToken("pageToken873572522")
307    *           .setFilter("filter-1274492040")
308    *           .build();
309    *   for (Insight element : recommenderClient.listInsights(request).iterateAll()) {
310    *     // doThingsWith(element);
311    *   }
312    * }
313    * }</pre>
314    *
315    * @param request The request object containing all of the parameters for the API call.
316    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
317    */
listInsights(ListInsightsRequest request)318   public final ListInsightsPagedResponse listInsights(ListInsightsRequest request) {
319     return listInsightsPagedCallable().call(request);
320   }
321 
322   // AUTO-GENERATED DOCUMENTATION AND METHOD.
323   /**
324    * Lists insights for the specified Cloud Resource. Requires the recommender.&#42;.list IAM
325    * permission for the specified insight type.
326    *
327    * <p>Sample code:
328    *
329    * <pre>{@code
330    * // This snippet has been automatically generated and should be regarded as a code template only.
331    * // It will require modifications to work:
332    * // - It may require correct/in-range values for request initialization.
333    * // - It may require specifying regional endpoints when creating the service client as shown in
334    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
335    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
336    *   ListInsightsRequest request =
337    *       ListInsightsRequest.newBuilder()
338    *           .setParent(
339    *               InsightTypeName.ofProjectLocationInsightTypeName(
340    *                       "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]")
341    *                   .toString())
342    *           .setPageSize(883849137)
343    *           .setPageToken("pageToken873572522")
344    *           .setFilter("filter-1274492040")
345    *           .build();
346    *   ApiFuture<Insight> future = recommenderClient.listInsightsPagedCallable().futureCall(request);
347    *   // Do something.
348    *   for (Insight element : future.get().iterateAll()) {
349    *     // doThingsWith(element);
350    *   }
351    * }
352    * }</pre>
353    */
354   public final UnaryCallable<ListInsightsRequest, ListInsightsPagedResponse>
listInsightsPagedCallable()355       listInsightsPagedCallable() {
356     return stub.listInsightsPagedCallable();
357   }
358 
359   // AUTO-GENERATED DOCUMENTATION AND METHOD.
360   /**
361    * Lists insights for the specified Cloud Resource. Requires the recommender.&#42;.list IAM
362    * permission for the specified insight type.
363    *
364    * <p>Sample code:
365    *
366    * <pre>{@code
367    * // This snippet has been automatically generated and should be regarded as a code template only.
368    * // It will require modifications to work:
369    * // - It may require correct/in-range values for request initialization.
370    * // - It may require specifying regional endpoints when creating the service client as shown in
371    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
372    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
373    *   ListInsightsRequest request =
374    *       ListInsightsRequest.newBuilder()
375    *           .setParent(
376    *               InsightTypeName.ofProjectLocationInsightTypeName(
377    *                       "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]")
378    *                   .toString())
379    *           .setPageSize(883849137)
380    *           .setPageToken("pageToken873572522")
381    *           .setFilter("filter-1274492040")
382    *           .build();
383    *   while (true) {
384    *     ListInsightsResponse response = recommenderClient.listInsightsCallable().call(request);
385    *     for (Insight element : response.getInsightsList()) {
386    *       // doThingsWith(element);
387    *     }
388    *     String nextPageToken = response.getNextPageToken();
389    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
390    *       request = request.toBuilder().setPageToken(nextPageToken).build();
391    *     } else {
392    *       break;
393    *     }
394    *   }
395    * }
396    * }</pre>
397    */
listInsightsCallable()398   public final UnaryCallable<ListInsightsRequest, ListInsightsResponse> listInsightsCallable() {
399     return stub.listInsightsCallable();
400   }
401 
402   // AUTO-GENERATED DOCUMENTATION AND METHOD.
403   /**
404    * Gets the requested insight. Requires the recommender.&#42;.get IAM permission for the specified
405    * insight type.
406    *
407    * <p>Sample code:
408    *
409    * <pre>{@code
410    * // This snippet has been automatically generated and should be regarded as a code template only.
411    * // It will require modifications to work:
412    * // - It may require correct/in-range values for request initialization.
413    * // - It may require specifying regional endpoints when creating the service client as shown in
414    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
415    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
416    *   InsightName name =
417    *       InsightName.ofProjectLocationInsightTypeInsightName(
418    *           "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]");
419    *   Insight response = recommenderClient.getInsight(name);
420    * }
421    * }</pre>
422    *
423    * @param name Required. Name of the insight.
424    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
425    */
getInsight(InsightName name)426   public final Insight getInsight(InsightName name) {
427     GetInsightRequest request =
428         GetInsightRequest.newBuilder().setName(name == null ? null : name.toString()).build();
429     return getInsight(request);
430   }
431 
432   // AUTO-GENERATED DOCUMENTATION AND METHOD.
433   /**
434    * Gets the requested insight. Requires the recommender.&#42;.get IAM permission for the specified
435    * insight type.
436    *
437    * <p>Sample code:
438    *
439    * <pre>{@code
440    * // This snippet has been automatically generated and should be regarded as a code template only.
441    * // It will require modifications to work:
442    * // - It may require correct/in-range values for request initialization.
443    * // - It may require specifying regional endpoints when creating the service client as shown in
444    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
445    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
446    *   String name =
447    *       InsightName.ofProjectLocationInsightTypeInsightName(
448    *               "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
449    *           .toString();
450    *   Insight response = recommenderClient.getInsight(name);
451    * }
452    * }</pre>
453    *
454    * @param name Required. Name of the insight.
455    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
456    */
getInsight(String name)457   public final Insight getInsight(String name) {
458     GetInsightRequest request = GetInsightRequest.newBuilder().setName(name).build();
459     return getInsight(request);
460   }
461 
462   // AUTO-GENERATED DOCUMENTATION AND METHOD.
463   /**
464    * Gets the requested insight. Requires the recommender.&#42;.get IAM permission for the specified
465    * insight type.
466    *
467    * <p>Sample code:
468    *
469    * <pre>{@code
470    * // This snippet has been automatically generated and should be regarded as a code template only.
471    * // It will require modifications to work:
472    * // - It may require correct/in-range values for request initialization.
473    * // - It may require specifying regional endpoints when creating the service client as shown in
474    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
475    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
476    *   GetInsightRequest request =
477    *       GetInsightRequest.newBuilder()
478    *           .setName(
479    *               InsightName.ofProjectLocationInsightTypeInsightName(
480    *                       "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
481    *                   .toString())
482    *           .build();
483    *   Insight response = recommenderClient.getInsight(request);
484    * }
485    * }</pre>
486    *
487    * @param request The request object containing all of the parameters for the API call.
488    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
489    */
getInsight(GetInsightRequest request)490   public final Insight getInsight(GetInsightRequest request) {
491     return getInsightCallable().call(request);
492   }
493 
494   // AUTO-GENERATED DOCUMENTATION AND METHOD.
495   /**
496    * Gets the requested insight. Requires the recommender.&#42;.get IAM permission for the specified
497    * insight type.
498    *
499    * <p>Sample code:
500    *
501    * <pre>{@code
502    * // This snippet has been automatically generated and should be regarded as a code template only.
503    * // It will require modifications to work:
504    * // - It may require correct/in-range values for request initialization.
505    * // - It may require specifying regional endpoints when creating the service client as shown in
506    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
507    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
508    *   GetInsightRequest request =
509    *       GetInsightRequest.newBuilder()
510    *           .setName(
511    *               InsightName.ofProjectLocationInsightTypeInsightName(
512    *                       "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
513    *                   .toString())
514    *           .build();
515    *   ApiFuture<Insight> future = recommenderClient.getInsightCallable().futureCall(request);
516    *   // Do something.
517    *   Insight response = future.get();
518    * }
519    * }</pre>
520    */
getInsightCallable()521   public final UnaryCallable<GetInsightRequest, Insight> getInsightCallable() {
522     return stub.getInsightCallable();
523   }
524 
525   // AUTO-GENERATED DOCUMENTATION AND METHOD.
526   /**
527    * Marks the Insight State as Accepted. Users can use this method to indicate to the Recommender
528    * API that they have applied some action based on the insight. This stops the insight content
529    * from being updated.
530    *
531    * <p>MarkInsightAccepted can be applied to insights in ACTIVE state. Requires the
532    * recommender.&#42;.update IAM permission for the specified insight.
533    *
534    * <p>Sample code:
535    *
536    * <pre>{@code
537    * // This snippet has been automatically generated and should be regarded as a code template only.
538    * // It will require modifications to work:
539    * // - It may require correct/in-range values for request initialization.
540    * // - It may require specifying regional endpoints when creating the service client as shown in
541    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
542    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
543    *   InsightName name =
544    *       InsightName.ofProjectLocationInsightTypeInsightName(
545    *           "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]");
546    *   Map<String, String> stateMetadata = new HashMap<>();
547    *   String etag = "etag3123477";
548    *   Insight response = recommenderClient.markInsightAccepted(name, stateMetadata, etag);
549    * }
550    * }</pre>
551    *
552    * @param name Required. Name of the insight.
553    * @param stateMetadata Optional. State properties user wish to include with this state. Full
554    *     replace of the current state_metadata.
555    * @param etag Required. Fingerprint of the Insight. Provides optimistic locking.
556    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
557    */
markInsightAccepted( InsightName name, Map<String, String> stateMetadata, String etag)558   public final Insight markInsightAccepted(
559       InsightName name, Map<String, String> stateMetadata, String etag) {
560     MarkInsightAcceptedRequest request =
561         MarkInsightAcceptedRequest.newBuilder()
562             .setName(name == null ? null : name.toString())
563             .putAllStateMetadata(stateMetadata)
564             .setEtag(etag)
565             .build();
566     return markInsightAccepted(request);
567   }
568 
569   // AUTO-GENERATED DOCUMENTATION AND METHOD.
570   /**
571    * Marks the Insight State as Accepted. Users can use this method to indicate to the Recommender
572    * API that they have applied some action based on the insight. This stops the insight content
573    * from being updated.
574    *
575    * <p>MarkInsightAccepted can be applied to insights in ACTIVE state. Requires the
576    * recommender.&#42;.update IAM permission for the specified insight.
577    *
578    * <p>Sample code:
579    *
580    * <pre>{@code
581    * // This snippet has been automatically generated and should be regarded as a code template only.
582    * // It will require modifications to work:
583    * // - It may require correct/in-range values for request initialization.
584    * // - It may require specifying regional endpoints when creating the service client as shown in
585    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
586    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
587    *   String name =
588    *       InsightName.ofProjectLocationInsightTypeInsightName(
589    *               "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
590    *           .toString();
591    *   Map<String, String> stateMetadata = new HashMap<>();
592    *   String etag = "etag3123477";
593    *   Insight response = recommenderClient.markInsightAccepted(name, stateMetadata, etag);
594    * }
595    * }</pre>
596    *
597    * @param name Required. Name of the insight.
598    * @param stateMetadata Optional. State properties user wish to include with this state. Full
599    *     replace of the current state_metadata.
600    * @param etag Required. Fingerprint of the Insight. Provides optimistic locking.
601    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
602    */
markInsightAccepted( String name, Map<String, String> stateMetadata, String etag)603   public final Insight markInsightAccepted(
604       String name, Map<String, String> stateMetadata, String etag) {
605     MarkInsightAcceptedRequest request =
606         MarkInsightAcceptedRequest.newBuilder()
607             .setName(name)
608             .putAllStateMetadata(stateMetadata)
609             .setEtag(etag)
610             .build();
611     return markInsightAccepted(request);
612   }
613 
614   // AUTO-GENERATED DOCUMENTATION AND METHOD.
615   /**
616    * Marks the Insight State as Accepted. Users can use this method to indicate to the Recommender
617    * API that they have applied some action based on the insight. This stops the insight content
618    * from being updated.
619    *
620    * <p>MarkInsightAccepted can be applied to insights in ACTIVE state. Requires the
621    * recommender.&#42;.update IAM permission for the specified insight.
622    *
623    * <p>Sample code:
624    *
625    * <pre>{@code
626    * // This snippet has been automatically generated and should be regarded as a code template only.
627    * // It will require modifications to work:
628    * // - It may require correct/in-range values for request initialization.
629    * // - It may require specifying regional endpoints when creating the service client as shown in
630    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
631    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
632    *   MarkInsightAcceptedRequest request =
633    *       MarkInsightAcceptedRequest.newBuilder()
634    *           .setName(
635    *               InsightName.ofProjectLocationInsightTypeInsightName(
636    *                       "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
637    *                   .toString())
638    *           .putAllStateMetadata(new HashMap<String, String>())
639    *           .setEtag("etag3123477")
640    *           .build();
641    *   Insight response = recommenderClient.markInsightAccepted(request);
642    * }
643    * }</pre>
644    *
645    * @param request The request object containing all of the parameters for the API call.
646    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
647    */
markInsightAccepted(MarkInsightAcceptedRequest request)648   public final Insight markInsightAccepted(MarkInsightAcceptedRequest request) {
649     return markInsightAcceptedCallable().call(request);
650   }
651 
652   // AUTO-GENERATED DOCUMENTATION AND METHOD.
653   /**
654    * Marks the Insight State as Accepted. Users can use this method to indicate to the Recommender
655    * API that they have applied some action based on the insight. This stops the insight content
656    * from being updated.
657    *
658    * <p>MarkInsightAccepted can be applied to insights in ACTIVE state. Requires the
659    * recommender.&#42;.update IAM permission for the specified insight.
660    *
661    * <p>Sample code:
662    *
663    * <pre>{@code
664    * // This snippet has been automatically generated and should be regarded as a code template only.
665    * // It will require modifications to work:
666    * // - It may require correct/in-range values for request initialization.
667    * // - It may require specifying regional endpoints when creating the service client as shown in
668    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
669    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
670    *   MarkInsightAcceptedRequest request =
671    *       MarkInsightAcceptedRequest.newBuilder()
672    *           .setName(
673    *               InsightName.ofProjectLocationInsightTypeInsightName(
674    *                       "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
675    *                   .toString())
676    *           .putAllStateMetadata(new HashMap<String, String>())
677    *           .setEtag("etag3123477")
678    *           .build();
679    *   ApiFuture<Insight> future =
680    *       recommenderClient.markInsightAcceptedCallable().futureCall(request);
681    *   // Do something.
682    *   Insight response = future.get();
683    * }
684    * }</pre>
685    */
markInsightAcceptedCallable()686   public final UnaryCallable<MarkInsightAcceptedRequest, Insight> markInsightAcceptedCallable() {
687     return stub.markInsightAcceptedCallable();
688   }
689 
690   // AUTO-GENERATED DOCUMENTATION AND METHOD.
691   /**
692    * Lists recommendations for the specified Cloud Resource. Requires the recommender.&#42;.list IAM
693    * permission for the specified recommender.
694    *
695    * <p>Sample code:
696    *
697    * <pre>{@code
698    * // This snippet has been automatically generated and should be regarded as a code template only.
699    * // It will require modifications to work:
700    * // - It may require correct/in-range values for request initialization.
701    * // - It may require specifying regional endpoints when creating the service client as shown in
702    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
703    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
704    *   RecommenderName parent =
705    *       RecommenderName.ofProjectLocationRecommenderName(
706    *           "[PROJECT]", "[LOCATION]", "[RECOMMENDER]");
707    *   String filter = "filter-1274492040";
708    *   for (Recommendation element :
709    *       recommenderClient.listRecommendations(parent, filter).iterateAll()) {
710    *     // doThingsWith(element);
711    *   }
712    * }
713    * }</pre>
714    *
715    * @param parent Required. The container resource on which to execute the request. Acceptable
716    *     formats:
717    *     <ul>
718    *       <li>`projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
719    *     </ul>
720    *     <ul>
721    *       <li>`projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
722    *     </ul>
723    *     <ul>
724    *       <li>`billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
725    *     </ul>
726    *     <ul>
727    *       <li>`folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
728    *     </ul>
729    *     <ul>
730    *       <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
731    *     </ul>
732    *     <p>LOCATION here refers to GCP Locations: https://cloud.google.com/about/locations/
733    *     RECOMMENDER_ID refers to supported recommenders:
734    *     https://cloud.google.com/recommender/docs/recommenders.
735    * @param filter Filter expression to restrict the recommendations returned. Supported filter
736    *     fields:
737    *     <ul>
738    *       <li>`state_info.state`
739    *     </ul>
740    *     <ul>
741    *       <li>`recommenderSubtype`
742    *     </ul>
743    *     <ul>
744    *       <li>`priority`
745    *     </ul>
746    *     <p>Examples:
747    *     <ul>
748    *       <li>`stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED`
749    *     </ul>
750    *     <ul>
751    *       <li>`recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE`
752    *     </ul>
753    *     <ul>
754    *       <li>`priority = P1 OR priority = P2`
755    *     </ul>
756    *     <ul>
757    *       <li>`stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)`
758    *     </ul>
759    *     <p>(These expressions are based on the filter language described at
760    *     https://google.aip.dev/160)
761    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
762    */
listRecommendations( RecommenderName parent, String filter)763   public final ListRecommendationsPagedResponse listRecommendations(
764       RecommenderName parent, String filter) {
765     ListRecommendationsRequest request =
766         ListRecommendationsRequest.newBuilder()
767             .setParent(parent == null ? null : parent.toString())
768             .setFilter(filter)
769             .build();
770     return listRecommendations(request);
771   }
772 
773   // AUTO-GENERATED DOCUMENTATION AND METHOD.
774   /**
775    * Lists recommendations for the specified Cloud Resource. Requires the recommender.&#42;.list IAM
776    * permission for the specified recommender.
777    *
778    * <p>Sample code:
779    *
780    * <pre>{@code
781    * // This snippet has been automatically generated and should be regarded as a code template only.
782    * // It will require modifications to work:
783    * // - It may require correct/in-range values for request initialization.
784    * // - It may require specifying regional endpoints when creating the service client as shown in
785    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
786    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
787    *   String parent =
788    *       RecommenderName.ofProjectLocationRecommenderName(
789    *               "[PROJECT]", "[LOCATION]", "[RECOMMENDER]")
790    *           .toString();
791    *   String filter = "filter-1274492040";
792    *   for (Recommendation element :
793    *       recommenderClient.listRecommendations(parent, filter).iterateAll()) {
794    *     // doThingsWith(element);
795    *   }
796    * }
797    * }</pre>
798    *
799    * @param parent Required. The container resource on which to execute the request. Acceptable
800    *     formats:
801    *     <ul>
802    *       <li>`projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
803    *     </ul>
804    *     <ul>
805    *       <li>`projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
806    *     </ul>
807    *     <ul>
808    *       <li>`billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
809    *     </ul>
810    *     <ul>
811    *       <li>`folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
812    *     </ul>
813    *     <ul>
814    *       <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
815    *     </ul>
816    *     <p>LOCATION here refers to GCP Locations: https://cloud.google.com/about/locations/
817    *     RECOMMENDER_ID refers to supported recommenders:
818    *     https://cloud.google.com/recommender/docs/recommenders.
819    * @param filter Filter expression to restrict the recommendations returned. Supported filter
820    *     fields:
821    *     <ul>
822    *       <li>`state_info.state`
823    *     </ul>
824    *     <ul>
825    *       <li>`recommenderSubtype`
826    *     </ul>
827    *     <ul>
828    *       <li>`priority`
829    *     </ul>
830    *     <p>Examples:
831    *     <ul>
832    *       <li>`stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED`
833    *     </ul>
834    *     <ul>
835    *       <li>`recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE`
836    *     </ul>
837    *     <ul>
838    *       <li>`priority = P1 OR priority = P2`
839    *     </ul>
840    *     <ul>
841    *       <li>`stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)`
842    *     </ul>
843    *     <p>(These expressions are based on the filter language described at
844    *     https://google.aip.dev/160)
845    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
846    */
listRecommendations(String parent, String filter)847   public final ListRecommendationsPagedResponse listRecommendations(String parent, String filter) {
848     ListRecommendationsRequest request =
849         ListRecommendationsRequest.newBuilder().setParent(parent).setFilter(filter).build();
850     return listRecommendations(request);
851   }
852 
853   // AUTO-GENERATED DOCUMENTATION AND METHOD.
854   /**
855    * Lists recommendations for the specified Cloud Resource. Requires the recommender.&#42;.list IAM
856    * permission for the specified recommender.
857    *
858    * <p>Sample code:
859    *
860    * <pre>{@code
861    * // This snippet has been automatically generated and should be regarded as a code template only.
862    * // It will require modifications to work:
863    * // - It may require correct/in-range values for request initialization.
864    * // - It may require specifying regional endpoints when creating the service client as shown in
865    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
866    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
867    *   ListRecommendationsRequest request =
868    *       ListRecommendationsRequest.newBuilder()
869    *           .setParent(
870    *               RecommenderName.ofProjectLocationRecommenderName(
871    *                       "[PROJECT]", "[LOCATION]", "[RECOMMENDER]")
872    *                   .toString())
873    *           .setPageSize(883849137)
874    *           .setPageToken("pageToken873572522")
875    *           .setFilter("filter-1274492040")
876    *           .build();
877    *   for (Recommendation element : recommenderClient.listRecommendations(request).iterateAll()) {
878    *     // doThingsWith(element);
879    *   }
880    * }
881    * }</pre>
882    *
883    * @param request The request object containing all of the parameters for the API call.
884    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
885    */
listRecommendations( ListRecommendationsRequest request)886   public final ListRecommendationsPagedResponse listRecommendations(
887       ListRecommendationsRequest request) {
888     return listRecommendationsPagedCallable().call(request);
889   }
890 
891   // AUTO-GENERATED DOCUMENTATION AND METHOD.
892   /**
893    * Lists recommendations for the specified Cloud Resource. Requires the recommender.&#42;.list IAM
894    * permission for the specified recommender.
895    *
896    * <p>Sample code:
897    *
898    * <pre>{@code
899    * // This snippet has been automatically generated and should be regarded as a code template only.
900    * // It will require modifications to work:
901    * // - It may require correct/in-range values for request initialization.
902    * // - It may require specifying regional endpoints when creating the service client as shown in
903    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
904    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
905    *   ListRecommendationsRequest request =
906    *       ListRecommendationsRequest.newBuilder()
907    *           .setParent(
908    *               RecommenderName.ofProjectLocationRecommenderName(
909    *                       "[PROJECT]", "[LOCATION]", "[RECOMMENDER]")
910    *                   .toString())
911    *           .setPageSize(883849137)
912    *           .setPageToken("pageToken873572522")
913    *           .setFilter("filter-1274492040")
914    *           .build();
915    *   ApiFuture<Recommendation> future =
916    *       recommenderClient.listRecommendationsPagedCallable().futureCall(request);
917    *   // Do something.
918    *   for (Recommendation element : future.get().iterateAll()) {
919    *     // doThingsWith(element);
920    *   }
921    * }
922    * }</pre>
923    */
924   public final UnaryCallable<ListRecommendationsRequest, ListRecommendationsPagedResponse>
listRecommendationsPagedCallable()925       listRecommendationsPagedCallable() {
926     return stub.listRecommendationsPagedCallable();
927   }
928 
929   // AUTO-GENERATED DOCUMENTATION AND METHOD.
930   /**
931    * Lists recommendations for the specified Cloud Resource. Requires the recommender.&#42;.list IAM
932    * permission for the specified recommender.
933    *
934    * <p>Sample code:
935    *
936    * <pre>{@code
937    * // This snippet has been automatically generated and should be regarded as a code template only.
938    * // It will require modifications to work:
939    * // - It may require correct/in-range values for request initialization.
940    * // - It may require specifying regional endpoints when creating the service client as shown in
941    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
942    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
943    *   ListRecommendationsRequest request =
944    *       ListRecommendationsRequest.newBuilder()
945    *           .setParent(
946    *               RecommenderName.ofProjectLocationRecommenderName(
947    *                       "[PROJECT]", "[LOCATION]", "[RECOMMENDER]")
948    *                   .toString())
949    *           .setPageSize(883849137)
950    *           .setPageToken("pageToken873572522")
951    *           .setFilter("filter-1274492040")
952    *           .build();
953    *   while (true) {
954    *     ListRecommendationsResponse response =
955    *         recommenderClient.listRecommendationsCallable().call(request);
956    *     for (Recommendation element : response.getRecommendationsList()) {
957    *       // doThingsWith(element);
958    *     }
959    *     String nextPageToken = response.getNextPageToken();
960    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
961    *       request = request.toBuilder().setPageToken(nextPageToken).build();
962    *     } else {
963    *       break;
964    *     }
965    *   }
966    * }
967    * }</pre>
968    */
969   public final UnaryCallable<ListRecommendationsRequest, ListRecommendationsResponse>
listRecommendationsCallable()970       listRecommendationsCallable() {
971     return stub.listRecommendationsCallable();
972   }
973 
974   // AUTO-GENERATED DOCUMENTATION AND METHOD.
975   /**
976    * Gets the requested recommendation. Requires the recommender.&#42;.get IAM permission for the
977    * specified recommender.
978    *
979    * <p>Sample code:
980    *
981    * <pre>{@code
982    * // This snippet has been automatically generated and should be regarded as a code template only.
983    * // It will require modifications to work:
984    * // - It may require correct/in-range values for request initialization.
985    * // - It may require specifying regional endpoints when creating the service client as shown in
986    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
987    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
988    *   RecommendationName name =
989    *       RecommendationName.ofProjectLocationRecommenderRecommendationName(
990    *           "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
991    *   Recommendation response = recommenderClient.getRecommendation(name);
992    * }
993    * }</pre>
994    *
995    * @param name Required. Name of the recommendation.
996    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
997    */
getRecommendation(RecommendationName name)998   public final Recommendation getRecommendation(RecommendationName name) {
999     GetRecommendationRequest request =
1000         GetRecommendationRequest.newBuilder()
1001             .setName(name == null ? null : name.toString())
1002             .build();
1003     return getRecommendation(request);
1004   }
1005 
1006   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1007   /**
1008    * Gets the requested recommendation. Requires the recommender.&#42;.get IAM permission for the
1009    * specified recommender.
1010    *
1011    * <p>Sample code:
1012    *
1013    * <pre>{@code
1014    * // This snippet has been automatically generated and should be regarded as a code template only.
1015    * // It will require modifications to work:
1016    * // - It may require correct/in-range values for request initialization.
1017    * // - It may require specifying regional endpoints when creating the service client as shown in
1018    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1019    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1020    *   String name =
1021    *       RecommendationName.ofProjectLocationRecommenderRecommendationName(
1022    *               "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1023    *           .toString();
1024    *   Recommendation response = recommenderClient.getRecommendation(name);
1025    * }
1026    * }</pre>
1027    *
1028    * @param name Required. Name of the recommendation.
1029    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1030    */
getRecommendation(String name)1031   public final Recommendation getRecommendation(String name) {
1032     GetRecommendationRequest request = GetRecommendationRequest.newBuilder().setName(name).build();
1033     return getRecommendation(request);
1034   }
1035 
1036   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1037   /**
1038    * Gets the requested recommendation. Requires the recommender.&#42;.get IAM permission for the
1039    * specified recommender.
1040    *
1041    * <p>Sample code:
1042    *
1043    * <pre>{@code
1044    * // This snippet has been automatically generated and should be regarded as a code template only.
1045    * // It will require modifications to work:
1046    * // - It may require correct/in-range values for request initialization.
1047    * // - It may require specifying regional endpoints when creating the service client as shown in
1048    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1049    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1050    *   GetRecommendationRequest request =
1051    *       GetRecommendationRequest.newBuilder()
1052    *           .setName(
1053    *               RecommendationName.ofProjectLocationRecommenderRecommendationName(
1054    *                       "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1055    *                   .toString())
1056    *           .build();
1057    *   Recommendation response = recommenderClient.getRecommendation(request);
1058    * }
1059    * }</pre>
1060    *
1061    * @param request The request object containing all of the parameters for the API call.
1062    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1063    */
getRecommendation(GetRecommendationRequest request)1064   public final Recommendation getRecommendation(GetRecommendationRequest request) {
1065     return getRecommendationCallable().call(request);
1066   }
1067 
1068   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1069   /**
1070    * Gets the requested recommendation. Requires the recommender.&#42;.get IAM permission for the
1071    * specified recommender.
1072    *
1073    * <p>Sample code:
1074    *
1075    * <pre>{@code
1076    * // This snippet has been automatically generated and should be regarded as a code template only.
1077    * // It will require modifications to work:
1078    * // - It may require correct/in-range values for request initialization.
1079    * // - It may require specifying regional endpoints when creating the service client as shown in
1080    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1081    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1082    *   GetRecommendationRequest request =
1083    *       GetRecommendationRequest.newBuilder()
1084    *           .setName(
1085    *               RecommendationName.ofProjectLocationRecommenderRecommendationName(
1086    *                       "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1087    *                   .toString())
1088    *           .build();
1089    *   ApiFuture<Recommendation> future =
1090    *       recommenderClient.getRecommendationCallable().futureCall(request);
1091    *   // Do something.
1092    *   Recommendation response = future.get();
1093    * }
1094    * }</pre>
1095    */
getRecommendationCallable()1096   public final UnaryCallable<GetRecommendationRequest, Recommendation> getRecommendationCallable() {
1097     return stub.getRecommendationCallable();
1098   }
1099 
1100   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1101   /**
1102    * Marks the Recommendation State as Claimed. Users can use this method to indicate to the
1103    * Recommender API that they are starting to apply the recommendation themselves. This stops the
1104    * recommendation content from being updated. Associated insights are frozen and placed in the
1105    * ACCEPTED state.
1106    *
1107    * <p>MarkRecommendationClaimed can be applied to recommendations in CLAIMED or ACTIVE state.
1108    *
1109    * <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1110    *
1111    * <p>Sample code:
1112    *
1113    * <pre>{@code
1114    * // This snippet has been automatically generated and should be regarded as a code template only.
1115    * // It will require modifications to work:
1116    * // - It may require correct/in-range values for request initialization.
1117    * // - It may require specifying regional endpoints when creating the service client as shown in
1118    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1119    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1120    *   RecommendationName name =
1121    *       RecommendationName.ofProjectLocationRecommenderRecommendationName(
1122    *           "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
1123    *   Map<String, String> stateMetadata = new HashMap<>();
1124    *   String etag = "etag3123477";
1125    *   Recommendation response =
1126    *       recommenderClient.markRecommendationClaimed(name, stateMetadata, etag);
1127    * }
1128    * }</pre>
1129    *
1130    * @param name Required. Name of the recommendation.
1131    * @param stateMetadata State properties to include with this state. Overwrites any existing
1132    *     `state_metadata`. Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. Values must
1133    *     match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.
1134    * @param etag Required. Fingerprint of the Recommendation. Provides optimistic locking.
1135    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1136    */
markRecommendationClaimed( RecommendationName name, Map<String, String> stateMetadata, String etag)1137   public final Recommendation markRecommendationClaimed(
1138       RecommendationName name, Map<String, String> stateMetadata, String etag) {
1139     MarkRecommendationClaimedRequest request =
1140         MarkRecommendationClaimedRequest.newBuilder()
1141             .setName(name == null ? null : name.toString())
1142             .putAllStateMetadata(stateMetadata)
1143             .setEtag(etag)
1144             .build();
1145     return markRecommendationClaimed(request);
1146   }
1147 
1148   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1149   /**
1150    * Marks the Recommendation State as Claimed. Users can use this method to indicate to the
1151    * Recommender API that they are starting to apply the recommendation themselves. This stops the
1152    * recommendation content from being updated. Associated insights are frozen and placed in the
1153    * ACCEPTED state.
1154    *
1155    * <p>MarkRecommendationClaimed can be applied to recommendations in CLAIMED or ACTIVE state.
1156    *
1157    * <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1158    *
1159    * <p>Sample code:
1160    *
1161    * <pre>{@code
1162    * // This snippet has been automatically generated and should be regarded as a code template only.
1163    * // It will require modifications to work:
1164    * // - It may require correct/in-range values for request initialization.
1165    * // - It may require specifying regional endpoints when creating the service client as shown in
1166    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1167    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1168    *   String name =
1169    *       RecommendationName.ofProjectLocationRecommenderRecommendationName(
1170    *               "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1171    *           .toString();
1172    *   Map<String, String> stateMetadata = new HashMap<>();
1173    *   String etag = "etag3123477";
1174    *   Recommendation response =
1175    *       recommenderClient.markRecommendationClaimed(name, stateMetadata, etag);
1176    * }
1177    * }</pre>
1178    *
1179    * @param name Required. Name of the recommendation.
1180    * @param stateMetadata State properties to include with this state. Overwrites any existing
1181    *     `state_metadata`. Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. Values must
1182    *     match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.
1183    * @param etag Required. Fingerprint of the Recommendation. Provides optimistic locking.
1184    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1185    */
markRecommendationClaimed( String name, Map<String, String> stateMetadata, String etag)1186   public final Recommendation markRecommendationClaimed(
1187       String name, Map<String, String> stateMetadata, String etag) {
1188     MarkRecommendationClaimedRequest request =
1189         MarkRecommendationClaimedRequest.newBuilder()
1190             .setName(name)
1191             .putAllStateMetadata(stateMetadata)
1192             .setEtag(etag)
1193             .build();
1194     return markRecommendationClaimed(request);
1195   }
1196 
1197   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1198   /**
1199    * Marks the Recommendation State as Claimed. Users can use this method to indicate to the
1200    * Recommender API that they are starting to apply the recommendation themselves. This stops the
1201    * recommendation content from being updated. Associated insights are frozen and placed in the
1202    * ACCEPTED state.
1203    *
1204    * <p>MarkRecommendationClaimed can be applied to recommendations in CLAIMED or ACTIVE state.
1205    *
1206    * <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1207    *
1208    * <p>Sample code:
1209    *
1210    * <pre>{@code
1211    * // This snippet has been automatically generated and should be regarded as a code template only.
1212    * // It will require modifications to work:
1213    * // - It may require correct/in-range values for request initialization.
1214    * // - It may require specifying regional endpoints when creating the service client as shown in
1215    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1216    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1217    *   MarkRecommendationClaimedRequest request =
1218    *       MarkRecommendationClaimedRequest.newBuilder()
1219    *           .setName(
1220    *               RecommendationName.ofProjectLocationRecommenderRecommendationName(
1221    *                       "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1222    *                   .toString())
1223    *           .putAllStateMetadata(new HashMap<String, String>())
1224    *           .setEtag("etag3123477")
1225    *           .build();
1226    *   Recommendation response = recommenderClient.markRecommendationClaimed(request);
1227    * }
1228    * }</pre>
1229    *
1230    * @param request The request object containing all of the parameters for the API call.
1231    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1232    */
markRecommendationClaimed(MarkRecommendationClaimedRequest request)1233   public final Recommendation markRecommendationClaimed(MarkRecommendationClaimedRequest request) {
1234     return markRecommendationClaimedCallable().call(request);
1235   }
1236 
1237   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1238   /**
1239    * Marks the Recommendation State as Claimed. Users can use this method to indicate to the
1240    * Recommender API that they are starting to apply the recommendation themselves. This stops the
1241    * recommendation content from being updated. Associated insights are frozen and placed in the
1242    * ACCEPTED state.
1243    *
1244    * <p>MarkRecommendationClaimed can be applied to recommendations in CLAIMED or ACTIVE state.
1245    *
1246    * <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1247    *
1248    * <p>Sample code:
1249    *
1250    * <pre>{@code
1251    * // This snippet has been automatically generated and should be regarded as a code template only.
1252    * // It will require modifications to work:
1253    * // - It may require correct/in-range values for request initialization.
1254    * // - It may require specifying regional endpoints when creating the service client as shown in
1255    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1256    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1257    *   MarkRecommendationClaimedRequest request =
1258    *       MarkRecommendationClaimedRequest.newBuilder()
1259    *           .setName(
1260    *               RecommendationName.ofProjectLocationRecommenderRecommendationName(
1261    *                       "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1262    *                   .toString())
1263    *           .putAllStateMetadata(new HashMap<String, String>())
1264    *           .setEtag("etag3123477")
1265    *           .build();
1266    *   ApiFuture<Recommendation> future =
1267    *       recommenderClient.markRecommendationClaimedCallable().futureCall(request);
1268    *   // Do something.
1269    *   Recommendation response = future.get();
1270    * }
1271    * }</pre>
1272    */
1273   public final UnaryCallable<MarkRecommendationClaimedRequest, Recommendation>
markRecommendationClaimedCallable()1274       markRecommendationClaimedCallable() {
1275     return stub.markRecommendationClaimedCallable();
1276   }
1277 
1278   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1279   /**
1280    * Marks the Recommendation State as Succeeded. Users can use this method to indicate to the
1281    * Recommender API that they have applied the recommendation themselves, and the operation was
1282    * successful. This stops the recommendation content from being updated. Associated insights are
1283    * frozen and placed in the ACCEPTED state.
1284    *
1285    * <p>MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED,
1286    * or FAILED state.
1287    *
1288    * <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1289    *
1290    * <p>Sample code:
1291    *
1292    * <pre>{@code
1293    * // This snippet has been automatically generated and should be regarded as a code template only.
1294    * // It will require modifications to work:
1295    * // - It may require correct/in-range values for request initialization.
1296    * // - It may require specifying regional endpoints when creating the service client as shown in
1297    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1298    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1299    *   RecommendationName name =
1300    *       RecommendationName.ofProjectLocationRecommenderRecommendationName(
1301    *           "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
1302    *   Map<String, String> stateMetadata = new HashMap<>();
1303    *   String etag = "etag3123477";
1304    *   Recommendation response =
1305    *       recommenderClient.markRecommendationSucceeded(name, stateMetadata, etag);
1306    * }
1307    * }</pre>
1308    *
1309    * @param name Required. Name of the recommendation.
1310    * @param stateMetadata State properties to include with this state. Overwrites any existing
1311    *     `state_metadata`. Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. Values must
1312    *     match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.
1313    * @param etag Required. Fingerprint of the Recommendation. Provides optimistic locking.
1314    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1315    */
markRecommendationSucceeded( RecommendationName name, Map<String, String> stateMetadata, String etag)1316   public final Recommendation markRecommendationSucceeded(
1317       RecommendationName name, Map<String, String> stateMetadata, String etag) {
1318     MarkRecommendationSucceededRequest request =
1319         MarkRecommendationSucceededRequest.newBuilder()
1320             .setName(name == null ? null : name.toString())
1321             .putAllStateMetadata(stateMetadata)
1322             .setEtag(etag)
1323             .build();
1324     return markRecommendationSucceeded(request);
1325   }
1326 
1327   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1328   /**
1329    * Marks the Recommendation State as Succeeded. Users can use this method to indicate to the
1330    * Recommender API that they have applied the recommendation themselves, and the operation was
1331    * successful. This stops the recommendation content from being updated. Associated insights are
1332    * frozen and placed in the ACCEPTED state.
1333    *
1334    * <p>MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED,
1335    * or FAILED state.
1336    *
1337    * <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1338    *
1339    * <p>Sample code:
1340    *
1341    * <pre>{@code
1342    * // This snippet has been automatically generated and should be regarded as a code template only.
1343    * // It will require modifications to work:
1344    * // - It may require correct/in-range values for request initialization.
1345    * // - It may require specifying regional endpoints when creating the service client as shown in
1346    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1347    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1348    *   String name =
1349    *       RecommendationName.ofProjectLocationRecommenderRecommendationName(
1350    *               "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1351    *           .toString();
1352    *   Map<String, String> stateMetadata = new HashMap<>();
1353    *   String etag = "etag3123477";
1354    *   Recommendation response =
1355    *       recommenderClient.markRecommendationSucceeded(name, stateMetadata, etag);
1356    * }
1357    * }</pre>
1358    *
1359    * @param name Required. Name of the recommendation.
1360    * @param stateMetadata State properties to include with this state. Overwrites any existing
1361    *     `state_metadata`. Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. Values must
1362    *     match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.
1363    * @param etag Required. Fingerprint of the Recommendation. Provides optimistic locking.
1364    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1365    */
markRecommendationSucceeded( String name, Map<String, String> stateMetadata, String etag)1366   public final Recommendation markRecommendationSucceeded(
1367       String name, Map<String, String> stateMetadata, String etag) {
1368     MarkRecommendationSucceededRequest request =
1369         MarkRecommendationSucceededRequest.newBuilder()
1370             .setName(name)
1371             .putAllStateMetadata(stateMetadata)
1372             .setEtag(etag)
1373             .build();
1374     return markRecommendationSucceeded(request);
1375   }
1376 
1377   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1378   /**
1379    * Marks the Recommendation State as Succeeded. Users can use this method to indicate to the
1380    * Recommender API that they have applied the recommendation themselves, and the operation was
1381    * successful. This stops the recommendation content from being updated. Associated insights are
1382    * frozen and placed in the ACCEPTED state.
1383    *
1384    * <p>MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED,
1385    * or FAILED state.
1386    *
1387    * <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1388    *
1389    * <p>Sample code:
1390    *
1391    * <pre>{@code
1392    * // This snippet has been automatically generated and should be regarded as a code template only.
1393    * // It will require modifications to work:
1394    * // - It may require correct/in-range values for request initialization.
1395    * // - It may require specifying regional endpoints when creating the service client as shown in
1396    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1397    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1398    *   MarkRecommendationSucceededRequest request =
1399    *       MarkRecommendationSucceededRequest.newBuilder()
1400    *           .setName(
1401    *               RecommendationName.ofProjectLocationRecommenderRecommendationName(
1402    *                       "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1403    *                   .toString())
1404    *           .putAllStateMetadata(new HashMap<String, String>())
1405    *           .setEtag("etag3123477")
1406    *           .build();
1407    *   Recommendation response = recommenderClient.markRecommendationSucceeded(request);
1408    * }
1409    * }</pre>
1410    *
1411    * @param request The request object containing all of the parameters for the API call.
1412    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1413    */
markRecommendationSucceeded( MarkRecommendationSucceededRequest request)1414   public final Recommendation markRecommendationSucceeded(
1415       MarkRecommendationSucceededRequest request) {
1416     return markRecommendationSucceededCallable().call(request);
1417   }
1418 
1419   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1420   /**
1421    * Marks the Recommendation State as Succeeded. Users can use this method to indicate to the
1422    * Recommender API that they have applied the recommendation themselves, and the operation was
1423    * successful. This stops the recommendation content from being updated. Associated insights are
1424    * frozen and placed in the ACCEPTED state.
1425    *
1426    * <p>MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED,
1427    * or FAILED state.
1428    *
1429    * <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1430    *
1431    * <p>Sample code:
1432    *
1433    * <pre>{@code
1434    * // This snippet has been automatically generated and should be regarded as a code template only.
1435    * // It will require modifications to work:
1436    * // - It may require correct/in-range values for request initialization.
1437    * // - It may require specifying regional endpoints when creating the service client as shown in
1438    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1439    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1440    *   MarkRecommendationSucceededRequest request =
1441    *       MarkRecommendationSucceededRequest.newBuilder()
1442    *           .setName(
1443    *               RecommendationName.ofProjectLocationRecommenderRecommendationName(
1444    *                       "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1445    *                   .toString())
1446    *           .putAllStateMetadata(new HashMap<String, String>())
1447    *           .setEtag("etag3123477")
1448    *           .build();
1449    *   ApiFuture<Recommendation> future =
1450    *       recommenderClient.markRecommendationSucceededCallable().futureCall(request);
1451    *   // Do something.
1452    *   Recommendation response = future.get();
1453    * }
1454    * }</pre>
1455    */
1456   public final UnaryCallable<MarkRecommendationSucceededRequest, Recommendation>
markRecommendationSucceededCallable()1457       markRecommendationSucceededCallable() {
1458     return stub.markRecommendationSucceededCallable();
1459   }
1460 
1461   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1462   /**
1463    * Marks the Recommendation State as Failed. Users can use this method to indicate to the
1464    * Recommender API that they have applied the recommendation themselves, and the operation failed.
1465    * This stops the recommendation content from being updated. Associated insights are frozen and
1466    * placed in the ACCEPTED state.
1467    *
1468    * <p>MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or
1469    * FAILED state.
1470    *
1471    * <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1472    *
1473    * <p>Sample code:
1474    *
1475    * <pre>{@code
1476    * // This snippet has been automatically generated and should be regarded as a code template only.
1477    * // It will require modifications to work:
1478    * // - It may require correct/in-range values for request initialization.
1479    * // - It may require specifying regional endpoints when creating the service client as shown in
1480    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1481    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1482    *   RecommendationName name =
1483    *       RecommendationName.ofProjectLocationRecommenderRecommendationName(
1484    *           "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
1485    *   Map<String, String> stateMetadata = new HashMap<>();
1486    *   String etag = "etag3123477";
1487    *   Recommendation response =
1488    *       recommenderClient.markRecommendationFailed(name, stateMetadata, etag);
1489    * }
1490    * }</pre>
1491    *
1492    * @param name Required. Name of the recommendation.
1493    * @param stateMetadata State properties to include with this state. Overwrites any existing
1494    *     `state_metadata`. Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. Values must
1495    *     match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.
1496    * @param etag Required. Fingerprint of the Recommendation. Provides optimistic locking.
1497    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1498    */
markRecommendationFailed( RecommendationName name, Map<String, String> stateMetadata, String etag)1499   public final Recommendation markRecommendationFailed(
1500       RecommendationName name, Map<String, String> stateMetadata, String etag) {
1501     MarkRecommendationFailedRequest request =
1502         MarkRecommendationFailedRequest.newBuilder()
1503             .setName(name == null ? null : name.toString())
1504             .putAllStateMetadata(stateMetadata)
1505             .setEtag(etag)
1506             .build();
1507     return markRecommendationFailed(request);
1508   }
1509 
1510   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1511   /**
1512    * Marks the Recommendation State as Failed. Users can use this method to indicate to the
1513    * Recommender API that they have applied the recommendation themselves, and the operation failed.
1514    * This stops the recommendation content from being updated. Associated insights are frozen and
1515    * placed in the ACCEPTED state.
1516    *
1517    * <p>MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or
1518    * FAILED state.
1519    *
1520    * <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1521    *
1522    * <p>Sample code:
1523    *
1524    * <pre>{@code
1525    * // This snippet has been automatically generated and should be regarded as a code template only.
1526    * // It will require modifications to work:
1527    * // - It may require correct/in-range values for request initialization.
1528    * // - It may require specifying regional endpoints when creating the service client as shown in
1529    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1530    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1531    *   String name =
1532    *       RecommendationName.ofProjectLocationRecommenderRecommendationName(
1533    *               "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1534    *           .toString();
1535    *   Map<String, String> stateMetadata = new HashMap<>();
1536    *   String etag = "etag3123477";
1537    *   Recommendation response =
1538    *       recommenderClient.markRecommendationFailed(name, stateMetadata, etag);
1539    * }
1540    * }</pre>
1541    *
1542    * @param name Required. Name of the recommendation.
1543    * @param stateMetadata State properties to include with this state. Overwrites any existing
1544    *     `state_metadata`. Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. Values must
1545    *     match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.
1546    * @param etag Required. Fingerprint of the Recommendation. Provides optimistic locking.
1547    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1548    */
markRecommendationFailed( String name, Map<String, String> stateMetadata, String etag)1549   public final Recommendation markRecommendationFailed(
1550       String name, Map<String, String> stateMetadata, String etag) {
1551     MarkRecommendationFailedRequest request =
1552         MarkRecommendationFailedRequest.newBuilder()
1553             .setName(name)
1554             .putAllStateMetadata(stateMetadata)
1555             .setEtag(etag)
1556             .build();
1557     return markRecommendationFailed(request);
1558   }
1559 
1560   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1561   /**
1562    * Marks the Recommendation State as Failed. Users can use this method to indicate to the
1563    * Recommender API that they have applied the recommendation themselves, and the operation failed.
1564    * This stops the recommendation content from being updated. Associated insights are frozen and
1565    * placed in the ACCEPTED state.
1566    *
1567    * <p>MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or
1568    * FAILED state.
1569    *
1570    * <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1571    *
1572    * <p>Sample code:
1573    *
1574    * <pre>{@code
1575    * // This snippet has been automatically generated and should be regarded as a code template only.
1576    * // It will require modifications to work:
1577    * // - It may require correct/in-range values for request initialization.
1578    * // - It may require specifying regional endpoints when creating the service client as shown in
1579    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1580    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1581    *   MarkRecommendationFailedRequest request =
1582    *       MarkRecommendationFailedRequest.newBuilder()
1583    *           .setName(
1584    *               RecommendationName.ofProjectLocationRecommenderRecommendationName(
1585    *                       "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1586    *                   .toString())
1587    *           .putAllStateMetadata(new HashMap<String, String>())
1588    *           .setEtag("etag3123477")
1589    *           .build();
1590    *   Recommendation response = recommenderClient.markRecommendationFailed(request);
1591    * }
1592    * }</pre>
1593    *
1594    * @param request The request object containing all of the parameters for the API call.
1595    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1596    */
markRecommendationFailed(MarkRecommendationFailedRequest request)1597   public final Recommendation markRecommendationFailed(MarkRecommendationFailedRequest request) {
1598     return markRecommendationFailedCallable().call(request);
1599   }
1600 
1601   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1602   /**
1603    * Marks the Recommendation State as Failed. Users can use this method to indicate to the
1604    * Recommender API that they have applied the recommendation themselves, and the operation failed.
1605    * This stops the recommendation content from being updated. Associated insights are frozen and
1606    * placed in the ACCEPTED state.
1607    *
1608    * <p>MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or
1609    * FAILED state.
1610    *
1611    * <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
1612    *
1613    * <p>Sample code:
1614    *
1615    * <pre>{@code
1616    * // This snippet has been automatically generated and should be regarded as a code template only.
1617    * // It will require modifications to work:
1618    * // - It may require correct/in-range values for request initialization.
1619    * // - It may require specifying regional endpoints when creating the service client as shown in
1620    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1621    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1622    *   MarkRecommendationFailedRequest request =
1623    *       MarkRecommendationFailedRequest.newBuilder()
1624    *           .setName(
1625    *               RecommendationName.ofProjectLocationRecommenderRecommendationName(
1626    *                       "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
1627    *                   .toString())
1628    *           .putAllStateMetadata(new HashMap<String, String>())
1629    *           .setEtag("etag3123477")
1630    *           .build();
1631    *   ApiFuture<Recommendation> future =
1632    *       recommenderClient.markRecommendationFailedCallable().futureCall(request);
1633    *   // Do something.
1634    *   Recommendation response = future.get();
1635    * }
1636    * }</pre>
1637    */
1638   public final UnaryCallable<MarkRecommendationFailedRequest, Recommendation>
markRecommendationFailedCallable()1639       markRecommendationFailedCallable() {
1640     return stub.markRecommendationFailedCallable();
1641   }
1642 
1643   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1644   /**
1645    * Gets the requested Recommender Config. There is only one instance of the config for each
1646    * Recommender.
1647    *
1648    * <p>Sample code:
1649    *
1650    * <pre>{@code
1651    * // This snippet has been automatically generated and should be regarded as a code template only.
1652    * // It will require modifications to work:
1653    * // - It may require correct/in-range values for request initialization.
1654    * // - It may require specifying regional endpoints when creating the service client as shown in
1655    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1656    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1657    *   RecommenderConfigName name =
1658    *       RecommenderConfigName.ofProjectLocationRecommenderName(
1659    *           "[PROJECT]", "[LOCATION]", "[RECOMMENDER]");
1660    *   RecommenderConfig response = recommenderClient.getRecommenderConfig(name);
1661    * }
1662    * }</pre>
1663    *
1664    * @param name Required. Name of the Recommendation Config to get.
1665    *     <p>Acceptable formats:
1666    *     <ul>
1667    *       <li>`projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
1668    *     </ul>
1669    *     <ul>
1670    *       <li>`projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
1671    *     </ul>
1672    *     <ul>
1673    *       <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
1674    *     </ul>
1675    *
1676    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1677    */
getRecommenderConfig(RecommenderConfigName name)1678   public final RecommenderConfig getRecommenderConfig(RecommenderConfigName name) {
1679     GetRecommenderConfigRequest request =
1680         GetRecommenderConfigRequest.newBuilder()
1681             .setName(name == null ? null : name.toString())
1682             .build();
1683     return getRecommenderConfig(request);
1684   }
1685 
1686   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1687   /**
1688    * Gets the requested Recommender Config. There is only one instance of the config for each
1689    * Recommender.
1690    *
1691    * <p>Sample code:
1692    *
1693    * <pre>{@code
1694    * // This snippet has been automatically generated and should be regarded as a code template only.
1695    * // It will require modifications to work:
1696    * // - It may require correct/in-range values for request initialization.
1697    * // - It may require specifying regional endpoints when creating the service client as shown in
1698    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1699    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1700    *   String name =
1701    *       RecommenderConfigName.ofProjectLocationRecommenderName(
1702    *               "[PROJECT]", "[LOCATION]", "[RECOMMENDER]")
1703    *           .toString();
1704    *   RecommenderConfig response = recommenderClient.getRecommenderConfig(name);
1705    * }
1706    * }</pre>
1707    *
1708    * @param name Required. Name of the Recommendation Config to get.
1709    *     <p>Acceptable formats:
1710    *     <ul>
1711    *       <li>`projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
1712    *     </ul>
1713    *     <ul>
1714    *       <li>`projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
1715    *     </ul>
1716    *     <ul>
1717    *       <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
1718    *     </ul>
1719    *
1720    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1721    */
getRecommenderConfig(String name)1722   public final RecommenderConfig getRecommenderConfig(String name) {
1723     GetRecommenderConfigRequest request =
1724         GetRecommenderConfigRequest.newBuilder().setName(name).build();
1725     return getRecommenderConfig(request);
1726   }
1727 
1728   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1729   /**
1730    * Gets the requested Recommender Config. There is only one instance of the config for each
1731    * Recommender.
1732    *
1733    * <p>Sample code:
1734    *
1735    * <pre>{@code
1736    * // This snippet has been automatically generated and should be regarded as a code template only.
1737    * // It will require modifications to work:
1738    * // - It may require correct/in-range values for request initialization.
1739    * // - It may require specifying regional endpoints when creating the service client as shown in
1740    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1741    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1742    *   GetRecommenderConfigRequest request =
1743    *       GetRecommenderConfigRequest.newBuilder()
1744    *           .setName(
1745    *               RecommenderConfigName.ofProjectLocationRecommenderName(
1746    *                       "[PROJECT]", "[LOCATION]", "[RECOMMENDER]")
1747    *                   .toString())
1748    *           .build();
1749    *   RecommenderConfig response = recommenderClient.getRecommenderConfig(request);
1750    * }
1751    * }</pre>
1752    *
1753    * @param request The request object containing all of the parameters for the API call.
1754    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1755    */
getRecommenderConfig(GetRecommenderConfigRequest request)1756   public final RecommenderConfig getRecommenderConfig(GetRecommenderConfigRequest request) {
1757     return getRecommenderConfigCallable().call(request);
1758   }
1759 
1760   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1761   /**
1762    * Gets the requested Recommender Config. There is only one instance of the config for each
1763    * Recommender.
1764    *
1765    * <p>Sample code:
1766    *
1767    * <pre>{@code
1768    * // This snippet has been automatically generated and should be regarded as a code template only.
1769    * // It will require modifications to work:
1770    * // - It may require correct/in-range values for request initialization.
1771    * // - It may require specifying regional endpoints when creating the service client as shown in
1772    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1773    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1774    *   GetRecommenderConfigRequest request =
1775    *       GetRecommenderConfigRequest.newBuilder()
1776    *           .setName(
1777    *               RecommenderConfigName.ofProjectLocationRecommenderName(
1778    *                       "[PROJECT]", "[LOCATION]", "[RECOMMENDER]")
1779    *                   .toString())
1780    *           .build();
1781    *   ApiFuture<RecommenderConfig> future =
1782    *       recommenderClient.getRecommenderConfigCallable().futureCall(request);
1783    *   // Do something.
1784    *   RecommenderConfig response = future.get();
1785    * }
1786    * }</pre>
1787    */
1788   public final UnaryCallable<GetRecommenderConfigRequest, RecommenderConfig>
getRecommenderConfigCallable()1789       getRecommenderConfigCallable() {
1790     return stub.getRecommenderConfigCallable();
1791   }
1792 
1793   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1794   /**
1795    * Updates a Recommender Config. This will create a new revision of the config.
1796    *
1797    * <p>Sample code:
1798    *
1799    * <pre>{@code
1800    * // This snippet has been automatically generated and should be regarded as a code template only.
1801    * // It will require modifications to work:
1802    * // - It may require correct/in-range values for request initialization.
1803    * // - It may require specifying regional endpoints when creating the service client as shown in
1804    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1805    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1806    *   RecommenderConfig recommenderConfig = RecommenderConfig.newBuilder().build();
1807    *   FieldMask updateMask = FieldMask.newBuilder().build();
1808    *   RecommenderConfig response =
1809    *       recommenderClient.updateRecommenderConfig(recommenderConfig, updateMask);
1810    * }
1811    * }</pre>
1812    *
1813    * @param recommenderConfig Required. The RecommenderConfig to update.
1814    * @param updateMask The list of fields to be updated.
1815    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1816    */
updateRecommenderConfig( RecommenderConfig recommenderConfig, FieldMask updateMask)1817   public final RecommenderConfig updateRecommenderConfig(
1818       RecommenderConfig recommenderConfig, FieldMask updateMask) {
1819     UpdateRecommenderConfigRequest request =
1820         UpdateRecommenderConfigRequest.newBuilder()
1821             .setRecommenderConfig(recommenderConfig)
1822             .setUpdateMask(updateMask)
1823             .build();
1824     return updateRecommenderConfig(request);
1825   }
1826 
1827   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1828   /**
1829    * Updates a Recommender Config. This will create a new revision of the config.
1830    *
1831    * <p>Sample code:
1832    *
1833    * <pre>{@code
1834    * // This snippet has been automatically generated and should be regarded as a code template only.
1835    * // It will require modifications to work:
1836    * // - It may require correct/in-range values for request initialization.
1837    * // - It may require specifying regional endpoints when creating the service client as shown in
1838    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1839    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1840    *   UpdateRecommenderConfigRequest request =
1841    *       UpdateRecommenderConfigRequest.newBuilder()
1842    *           .setRecommenderConfig(RecommenderConfig.newBuilder().build())
1843    *           .setUpdateMask(FieldMask.newBuilder().build())
1844    *           .setValidateOnly(true)
1845    *           .build();
1846    *   RecommenderConfig response = recommenderClient.updateRecommenderConfig(request);
1847    * }
1848    * }</pre>
1849    *
1850    * @param request The request object containing all of the parameters for the API call.
1851    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1852    */
updateRecommenderConfig(UpdateRecommenderConfigRequest request)1853   public final RecommenderConfig updateRecommenderConfig(UpdateRecommenderConfigRequest request) {
1854     return updateRecommenderConfigCallable().call(request);
1855   }
1856 
1857   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1858   /**
1859    * Updates a Recommender Config. This will create a new revision of the config.
1860    *
1861    * <p>Sample code:
1862    *
1863    * <pre>{@code
1864    * // This snippet has been automatically generated and should be regarded as a code template only.
1865    * // It will require modifications to work:
1866    * // - It may require correct/in-range values for request initialization.
1867    * // - It may require specifying regional endpoints when creating the service client as shown in
1868    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1869    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1870    *   UpdateRecommenderConfigRequest request =
1871    *       UpdateRecommenderConfigRequest.newBuilder()
1872    *           .setRecommenderConfig(RecommenderConfig.newBuilder().build())
1873    *           .setUpdateMask(FieldMask.newBuilder().build())
1874    *           .setValidateOnly(true)
1875    *           .build();
1876    *   ApiFuture<RecommenderConfig> future =
1877    *       recommenderClient.updateRecommenderConfigCallable().futureCall(request);
1878    *   // Do something.
1879    *   RecommenderConfig response = future.get();
1880    * }
1881    * }</pre>
1882    */
1883   public final UnaryCallable<UpdateRecommenderConfigRequest, RecommenderConfig>
updateRecommenderConfigCallable()1884       updateRecommenderConfigCallable() {
1885     return stub.updateRecommenderConfigCallable();
1886   }
1887 
1888   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1889   /**
1890    * Gets the requested InsightTypeConfig. There is only one instance of the config for each
1891    * InsightType.
1892    *
1893    * <p>Sample code:
1894    *
1895    * <pre>{@code
1896    * // This snippet has been automatically generated and should be regarded as a code template only.
1897    * // It will require modifications to work:
1898    * // - It may require correct/in-range values for request initialization.
1899    * // - It may require specifying regional endpoints when creating the service client as shown in
1900    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1901    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1902    *   InsightTypeConfigName name =
1903    *       InsightTypeConfigName.ofProjectLocationInsightTypeName(
1904    *           "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]");
1905    *   InsightTypeConfig response = recommenderClient.getInsightTypeConfig(name);
1906    * }
1907    * }</pre>
1908    *
1909    * @param name Required. Name of the InsightTypeConfig to get.
1910    *     <p>Acceptable formats:
1911    *     <ul>
1912    *       <li>`projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
1913    *     </ul>
1914    *     <ul>
1915    *       <li>`projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
1916    *     </ul>
1917    *     <ul>
1918    *       <li>`organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
1919    *     </ul>
1920    *
1921    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1922    */
getInsightTypeConfig(InsightTypeConfigName name)1923   public final InsightTypeConfig getInsightTypeConfig(InsightTypeConfigName name) {
1924     GetInsightTypeConfigRequest request =
1925         GetInsightTypeConfigRequest.newBuilder()
1926             .setName(name == null ? null : name.toString())
1927             .build();
1928     return getInsightTypeConfig(request);
1929   }
1930 
1931   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1932   /**
1933    * Gets the requested InsightTypeConfig. There is only one instance of the config for each
1934    * InsightType.
1935    *
1936    * <p>Sample code:
1937    *
1938    * <pre>{@code
1939    * // This snippet has been automatically generated and should be regarded as a code template only.
1940    * // It will require modifications to work:
1941    * // - It may require correct/in-range values for request initialization.
1942    * // - It may require specifying regional endpoints when creating the service client as shown in
1943    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1944    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1945    *   String name =
1946    *       InsightTypeConfigName.ofProjectLocationInsightTypeName(
1947    *               "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]")
1948    *           .toString();
1949    *   InsightTypeConfig response = recommenderClient.getInsightTypeConfig(name);
1950    * }
1951    * }</pre>
1952    *
1953    * @param name Required. Name of the InsightTypeConfig to get.
1954    *     <p>Acceptable formats:
1955    *     <ul>
1956    *       <li>`projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
1957    *     </ul>
1958    *     <ul>
1959    *       <li>`projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
1960    *     </ul>
1961    *     <ul>
1962    *       <li>`organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
1963    *     </ul>
1964    *
1965    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1966    */
getInsightTypeConfig(String name)1967   public final InsightTypeConfig getInsightTypeConfig(String name) {
1968     GetInsightTypeConfigRequest request =
1969         GetInsightTypeConfigRequest.newBuilder().setName(name).build();
1970     return getInsightTypeConfig(request);
1971   }
1972 
1973   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1974   /**
1975    * Gets the requested InsightTypeConfig. There is only one instance of the config for each
1976    * InsightType.
1977    *
1978    * <p>Sample code:
1979    *
1980    * <pre>{@code
1981    * // This snippet has been automatically generated and should be regarded as a code template only.
1982    * // It will require modifications to work:
1983    * // - It may require correct/in-range values for request initialization.
1984    * // - It may require specifying regional endpoints when creating the service client as shown in
1985    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1986    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
1987    *   GetInsightTypeConfigRequest request =
1988    *       GetInsightTypeConfigRequest.newBuilder()
1989    *           .setName(
1990    *               InsightTypeConfigName.ofProjectLocationInsightTypeName(
1991    *                       "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]")
1992    *                   .toString())
1993    *           .build();
1994    *   InsightTypeConfig response = recommenderClient.getInsightTypeConfig(request);
1995    * }
1996    * }</pre>
1997    *
1998    * @param request The request object containing all of the parameters for the API call.
1999    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2000    */
getInsightTypeConfig(GetInsightTypeConfigRequest request)2001   public final InsightTypeConfig getInsightTypeConfig(GetInsightTypeConfigRequest request) {
2002     return getInsightTypeConfigCallable().call(request);
2003   }
2004 
2005   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2006   /**
2007    * Gets the requested InsightTypeConfig. There is only one instance of the config for each
2008    * InsightType.
2009    *
2010    * <p>Sample code:
2011    *
2012    * <pre>{@code
2013    * // This snippet has been automatically generated and should be regarded as a code template only.
2014    * // It will require modifications to work:
2015    * // - It may require correct/in-range values for request initialization.
2016    * // - It may require specifying regional endpoints when creating the service client as shown in
2017    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2018    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
2019    *   GetInsightTypeConfigRequest request =
2020    *       GetInsightTypeConfigRequest.newBuilder()
2021    *           .setName(
2022    *               InsightTypeConfigName.ofProjectLocationInsightTypeName(
2023    *                       "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]")
2024    *                   .toString())
2025    *           .build();
2026    *   ApiFuture<InsightTypeConfig> future =
2027    *       recommenderClient.getInsightTypeConfigCallable().futureCall(request);
2028    *   // Do something.
2029    *   InsightTypeConfig response = future.get();
2030    * }
2031    * }</pre>
2032    */
2033   public final UnaryCallable<GetInsightTypeConfigRequest, InsightTypeConfig>
getInsightTypeConfigCallable()2034       getInsightTypeConfigCallable() {
2035     return stub.getInsightTypeConfigCallable();
2036   }
2037 
2038   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2039   /**
2040    * Updates an InsightTypeConfig change. This will create a new revision of the config.
2041    *
2042    * <p>Sample code:
2043    *
2044    * <pre>{@code
2045    * // This snippet has been automatically generated and should be regarded as a code template only.
2046    * // It will require modifications to work:
2047    * // - It may require correct/in-range values for request initialization.
2048    * // - It may require specifying regional endpoints when creating the service client as shown in
2049    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2050    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
2051    *   InsightTypeConfig insightTypeConfig = InsightTypeConfig.newBuilder().build();
2052    *   FieldMask updateMask = FieldMask.newBuilder().build();
2053    *   InsightTypeConfig response =
2054    *       recommenderClient.updateInsightTypeConfig(insightTypeConfig, updateMask);
2055    * }
2056    * }</pre>
2057    *
2058    * @param insightTypeConfig Required. The InsightTypeConfig to update.
2059    * @param updateMask The list of fields to be updated.
2060    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2061    */
updateInsightTypeConfig( InsightTypeConfig insightTypeConfig, FieldMask updateMask)2062   public final InsightTypeConfig updateInsightTypeConfig(
2063       InsightTypeConfig insightTypeConfig, FieldMask updateMask) {
2064     UpdateInsightTypeConfigRequest request =
2065         UpdateInsightTypeConfigRequest.newBuilder()
2066             .setInsightTypeConfig(insightTypeConfig)
2067             .setUpdateMask(updateMask)
2068             .build();
2069     return updateInsightTypeConfig(request);
2070   }
2071 
2072   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2073   /**
2074    * Updates an InsightTypeConfig change. This will create a new revision of the config.
2075    *
2076    * <p>Sample code:
2077    *
2078    * <pre>{@code
2079    * // This snippet has been automatically generated and should be regarded as a code template only.
2080    * // It will require modifications to work:
2081    * // - It may require correct/in-range values for request initialization.
2082    * // - It may require specifying regional endpoints when creating the service client as shown in
2083    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2084    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
2085    *   UpdateInsightTypeConfigRequest request =
2086    *       UpdateInsightTypeConfigRequest.newBuilder()
2087    *           .setInsightTypeConfig(InsightTypeConfig.newBuilder().build())
2088    *           .setUpdateMask(FieldMask.newBuilder().build())
2089    *           .setValidateOnly(true)
2090    *           .build();
2091    *   InsightTypeConfig response = recommenderClient.updateInsightTypeConfig(request);
2092    * }
2093    * }</pre>
2094    *
2095    * @param request The request object containing all of the parameters for the API call.
2096    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
2097    */
updateInsightTypeConfig(UpdateInsightTypeConfigRequest request)2098   public final InsightTypeConfig updateInsightTypeConfig(UpdateInsightTypeConfigRequest request) {
2099     return updateInsightTypeConfigCallable().call(request);
2100   }
2101 
2102   // AUTO-GENERATED DOCUMENTATION AND METHOD.
2103   /**
2104    * Updates an InsightTypeConfig change. This will create a new revision of the config.
2105    *
2106    * <p>Sample code:
2107    *
2108    * <pre>{@code
2109    * // This snippet has been automatically generated and should be regarded as a code template only.
2110    * // It will require modifications to work:
2111    * // - It may require correct/in-range values for request initialization.
2112    * // - It may require specifying regional endpoints when creating the service client as shown in
2113    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
2114    * try (RecommenderClient recommenderClient = RecommenderClient.create()) {
2115    *   UpdateInsightTypeConfigRequest request =
2116    *       UpdateInsightTypeConfigRequest.newBuilder()
2117    *           .setInsightTypeConfig(InsightTypeConfig.newBuilder().build())
2118    *           .setUpdateMask(FieldMask.newBuilder().build())
2119    *           .setValidateOnly(true)
2120    *           .build();
2121    *   ApiFuture<InsightTypeConfig> future =
2122    *       recommenderClient.updateInsightTypeConfigCallable().futureCall(request);
2123    *   // Do something.
2124    *   InsightTypeConfig response = future.get();
2125    * }
2126    * }</pre>
2127    */
2128   public final UnaryCallable<UpdateInsightTypeConfigRequest, InsightTypeConfig>
updateInsightTypeConfigCallable()2129       updateInsightTypeConfigCallable() {
2130     return stub.updateInsightTypeConfigCallable();
2131   }
2132 
2133   @Override
close()2134   public final void close() {
2135     stub.close();
2136   }
2137 
2138   @Override
shutdown()2139   public void shutdown() {
2140     stub.shutdown();
2141   }
2142 
2143   @Override
isShutdown()2144   public boolean isShutdown() {
2145     return stub.isShutdown();
2146   }
2147 
2148   @Override
isTerminated()2149   public boolean isTerminated() {
2150     return stub.isTerminated();
2151   }
2152 
2153   @Override
shutdownNow()2154   public void shutdownNow() {
2155     stub.shutdownNow();
2156   }
2157 
2158   @Override
awaitTermination(long duration, TimeUnit unit)2159   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
2160     return stub.awaitTermination(duration, unit);
2161   }
2162 
2163   public static class ListInsightsPagedResponse
2164       extends AbstractPagedListResponse<
2165           ListInsightsRequest,
2166           ListInsightsResponse,
2167           Insight,
2168           ListInsightsPage,
2169           ListInsightsFixedSizeCollection> {
2170 
createAsync( PageContext<ListInsightsRequest, ListInsightsResponse, Insight> context, ApiFuture<ListInsightsResponse> futureResponse)2171     public static ApiFuture<ListInsightsPagedResponse> createAsync(
2172         PageContext<ListInsightsRequest, ListInsightsResponse, Insight> context,
2173         ApiFuture<ListInsightsResponse> futureResponse) {
2174       ApiFuture<ListInsightsPage> futurePage =
2175           ListInsightsPage.createEmptyPage().createPageAsync(context, futureResponse);
2176       return ApiFutures.transform(
2177           futurePage,
2178           input -> new ListInsightsPagedResponse(input),
2179           MoreExecutors.directExecutor());
2180     }
2181 
ListInsightsPagedResponse(ListInsightsPage page)2182     private ListInsightsPagedResponse(ListInsightsPage page) {
2183       super(page, ListInsightsFixedSizeCollection.createEmptyCollection());
2184     }
2185   }
2186 
2187   public static class ListInsightsPage
2188       extends AbstractPage<ListInsightsRequest, ListInsightsResponse, Insight, ListInsightsPage> {
2189 
ListInsightsPage( PageContext<ListInsightsRequest, ListInsightsResponse, Insight> context, ListInsightsResponse response)2190     private ListInsightsPage(
2191         PageContext<ListInsightsRequest, ListInsightsResponse, Insight> context,
2192         ListInsightsResponse response) {
2193       super(context, response);
2194     }
2195 
createEmptyPage()2196     private static ListInsightsPage createEmptyPage() {
2197       return new ListInsightsPage(null, null);
2198     }
2199 
2200     @Override
createPage( PageContext<ListInsightsRequest, ListInsightsResponse, Insight> context, ListInsightsResponse response)2201     protected ListInsightsPage createPage(
2202         PageContext<ListInsightsRequest, ListInsightsResponse, Insight> context,
2203         ListInsightsResponse response) {
2204       return new ListInsightsPage(context, response);
2205     }
2206 
2207     @Override
createPageAsync( PageContext<ListInsightsRequest, ListInsightsResponse, Insight> context, ApiFuture<ListInsightsResponse> futureResponse)2208     public ApiFuture<ListInsightsPage> createPageAsync(
2209         PageContext<ListInsightsRequest, ListInsightsResponse, Insight> context,
2210         ApiFuture<ListInsightsResponse> futureResponse) {
2211       return super.createPageAsync(context, futureResponse);
2212     }
2213   }
2214 
2215   public static class ListInsightsFixedSizeCollection
2216       extends AbstractFixedSizeCollection<
2217           ListInsightsRequest,
2218           ListInsightsResponse,
2219           Insight,
2220           ListInsightsPage,
2221           ListInsightsFixedSizeCollection> {
2222 
ListInsightsFixedSizeCollection(List<ListInsightsPage> pages, int collectionSize)2223     private ListInsightsFixedSizeCollection(List<ListInsightsPage> pages, int collectionSize) {
2224       super(pages, collectionSize);
2225     }
2226 
createEmptyCollection()2227     private static ListInsightsFixedSizeCollection createEmptyCollection() {
2228       return new ListInsightsFixedSizeCollection(null, 0);
2229     }
2230 
2231     @Override
createCollection( List<ListInsightsPage> pages, int collectionSize)2232     protected ListInsightsFixedSizeCollection createCollection(
2233         List<ListInsightsPage> pages, int collectionSize) {
2234       return new ListInsightsFixedSizeCollection(pages, collectionSize);
2235     }
2236   }
2237 
2238   public static class ListRecommendationsPagedResponse
2239       extends AbstractPagedListResponse<
2240           ListRecommendationsRequest,
2241           ListRecommendationsResponse,
2242           Recommendation,
2243           ListRecommendationsPage,
2244           ListRecommendationsFixedSizeCollection> {
2245 
createAsync( PageContext<ListRecommendationsRequest, ListRecommendationsResponse, Recommendation> context, ApiFuture<ListRecommendationsResponse> futureResponse)2246     public static ApiFuture<ListRecommendationsPagedResponse> createAsync(
2247         PageContext<ListRecommendationsRequest, ListRecommendationsResponse, Recommendation>
2248             context,
2249         ApiFuture<ListRecommendationsResponse> futureResponse) {
2250       ApiFuture<ListRecommendationsPage> futurePage =
2251           ListRecommendationsPage.createEmptyPage().createPageAsync(context, futureResponse);
2252       return ApiFutures.transform(
2253           futurePage,
2254           input -> new ListRecommendationsPagedResponse(input),
2255           MoreExecutors.directExecutor());
2256     }
2257 
ListRecommendationsPagedResponse(ListRecommendationsPage page)2258     private ListRecommendationsPagedResponse(ListRecommendationsPage page) {
2259       super(page, ListRecommendationsFixedSizeCollection.createEmptyCollection());
2260     }
2261   }
2262 
2263   public static class ListRecommendationsPage
2264       extends AbstractPage<
2265           ListRecommendationsRequest,
2266           ListRecommendationsResponse,
2267           Recommendation,
2268           ListRecommendationsPage> {
2269 
ListRecommendationsPage( PageContext<ListRecommendationsRequest, ListRecommendationsResponse, Recommendation> context, ListRecommendationsResponse response)2270     private ListRecommendationsPage(
2271         PageContext<ListRecommendationsRequest, ListRecommendationsResponse, Recommendation>
2272             context,
2273         ListRecommendationsResponse response) {
2274       super(context, response);
2275     }
2276 
createEmptyPage()2277     private static ListRecommendationsPage createEmptyPage() {
2278       return new ListRecommendationsPage(null, null);
2279     }
2280 
2281     @Override
createPage( PageContext<ListRecommendationsRequest, ListRecommendationsResponse, Recommendation> context, ListRecommendationsResponse response)2282     protected ListRecommendationsPage createPage(
2283         PageContext<ListRecommendationsRequest, ListRecommendationsResponse, Recommendation>
2284             context,
2285         ListRecommendationsResponse response) {
2286       return new ListRecommendationsPage(context, response);
2287     }
2288 
2289     @Override
createPageAsync( PageContext<ListRecommendationsRequest, ListRecommendationsResponse, Recommendation> context, ApiFuture<ListRecommendationsResponse> futureResponse)2290     public ApiFuture<ListRecommendationsPage> createPageAsync(
2291         PageContext<ListRecommendationsRequest, ListRecommendationsResponse, Recommendation>
2292             context,
2293         ApiFuture<ListRecommendationsResponse> futureResponse) {
2294       return super.createPageAsync(context, futureResponse);
2295     }
2296   }
2297 
2298   public static class ListRecommendationsFixedSizeCollection
2299       extends AbstractFixedSizeCollection<
2300           ListRecommendationsRequest,
2301           ListRecommendationsResponse,
2302           Recommendation,
2303           ListRecommendationsPage,
2304           ListRecommendationsFixedSizeCollection> {
2305 
ListRecommendationsFixedSizeCollection( List<ListRecommendationsPage> pages, int collectionSize)2306     private ListRecommendationsFixedSizeCollection(
2307         List<ListRecommendationsPage> pages, int collectionSize) {
2308       super(pages, collectionSize);
2309     }
2310 
createEmptyCollection()2311     private static ListRecommendationsFixedSizeCollection createEmptyCollection() {
2312       return new ListRecommendationsFixedSizeCollection(null, 0);
2313     }
2314 
2315     @Override
createCollection( List<ListRecommendationsPage> pages, int collectionSize)2316     protected ListRecommendationsFixedSizeCollection createCollection(
2317         List<ListRecommendationsPage> pages, int collectionSize) {
2318       return new ListRecommendationsFixedSizeCollection(pages, collectionSize);
2319     }
2320   }
2321 }
2322