• 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.compute.v1;
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.longrunning.OperationFuture;
24 import com.google.api.gax.paging.AbstractFixedSizeCollection;
25 import com.google.api.gax.paging.AbstractPage;
26 import com.google.api.gax.paging.AbstractPagedListResponse;
27 import com.google.api.gax.rpc.OperationCallable;
28 import com.google.api.gax.rpc.PageContext;
29 import com.google.api.gax.rpc.UnaryCallable;
30 import com.google.cloud.compute.v1.stub.ForwardingRulesStub;
31 import com.google.cloud.compute.v1.stub.ForwardingRulesStubSettings;
32 import com.google.common.util.concurrent.MoreExecutors;
33 import java.io.IOException;
34 import java.util.List;
35 import java.util.Map;
36 import java.util.concurrent.TimeUnit;
37 import javax.annotation.Generated;
38 
39 // AUTO-GENERATED DOCUMENTATION AND CLASS.
40 /**
41  * Service Description: The ForwardingRules API.
42  *
43  * <p>This class provides the ability to make remote calls to the backing service through method
44  * calls that map to API methods. Sample code to get started:
45  *
46  * <pre>{@code
47  * // This snippet has been automatically generated and should be regarded as a code template only.
48  * // It will require modifications to work:
49  * // - It may require correct/in-range values for request initialization.
50  * // - It may require specifying regional endpoints when creating the service client as shown in
51  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
52  * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
53  *   String project = "project-309310695";
54  *   String region = "region-934795532";
55  *   String forwardingRule = "forwardingRule-1429104743";
56  *   ForwardingRule response = forwardingRulesClient.get(project, region, forwardingRule);
57  * }
58  * }</pre>
59  *
60  * <p>Note: close() needs to be called on the ForwardingRulesClient object to clean up resources
61  * such as threads. In the example above, try-with-resources is used, which automatically calls
62  * close().
63  *
64  * <p>The surface of this class includes several types of Java methods for each of the API's
65  * methods:
66  *
67  * <ol>
68  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
69  *       converted into function parameters. It may be the case that not all fields are available as
70  *       parameters, and not every API method will have a flattened method entry point.
71  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
72  *       which must be constructed before the call. Not every API method will have a request object
73  *       method.
74  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
75  *       callable object, which can be used to initiate calls to the service.
76  * </ol>
77  *
78  * <p>See the individual methods for example code.
79  *
80  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
81  * these names, this class includes a format method for each type of name, and additionally a parse
82  * method to extract the individual identifiers contained within names that are returned.
83  *
84  * <p>This class can be customized by passing in a custom instance of ForwardingRulesSettings to
85  * create(). For example:
86  *
87  * <p>To customize credentials:
88  *
89  * <pre>{@code
90  * // This snippet has been automatically generated and should be regarded as a code template only.
91  * // It will require modifications to work:
92  * // - It may require correct/in-range values for request initialization.
93  * // - It may require specifying regional endpoints when creating the service client as shown in
94  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
95  * ForwardingRulesSettings forwardingRulesSettings =
96  *     ForwardingRulesSettings.newBuilder()
97  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
98  *         .build();
99  * ForwardingRulesClient forwardingRulesClient =
100  *     ForwardingRulesClient.create(forwardingRulesSettings);
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  * ForwardingRulesSettings forwardingRulesSettings =
112  *     ForwardingRulesSettings.newBuilder().setEndpoint(myEndpoint).build();
113  * ForwardingRulesClient forwardingRulesClient =
114  *     ForwardingRulesClient.create(forwardingRulesSettings);
115  * }</pre>
116  *
117  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
118  */
119 @Generated("by gapic-generator-java")
120 public class ForwardingRulesClient implements BackgroundResource {
121   private final ForwardingRulesSettings settings;
122   private final ForwardingRulesStub stub;
123 
124   /** Constructs an instance of ForwardingRulesClient with default settings. */
create()125   public static final ForwardingRulesClient create() throws IOException {
126     return create(ForwardingRulesSettings.newBuilder().build());
127   }
128 
129   /**
130    * Constructs an instance of ForwardingRulesClient, using the given settings. The channels are
131    * created based on the settings passed in, or defaults for any settings that are not set.
132    */
create(ForwardingRulesSettings settings)133   public static final ForwardingRulesClient create(ForwardingRulesSettings settings)
134       throws IOException {
135     return new ForwardingRulesClient(settings);
136   }
137 
138   /**
139    * Constructs an instance of ForwardingRulesClient, using the given stub for making calls. This is
140    * for advanced usage - prefer using create(ForwardingRulesSettings).
141    */
create(ForwardingRulesStub stub)142   public static final ForwardingRulesClient create(ForwardingRulesStub stub) {
143     return new ForwardingRulesClient(stub);
144   }
145 
146   /**
147    * Constructs an instance of ForwardingRulesClient, using the given settings. This is protected so
148    * that it is easy to make a subclass, but otherwise, the static factory methods should be
149    * preferred.
150    */
ForwardingRulesClient(ForwardingRulesSettings settings)151   protected ForwardingRulesClient(ForwardingRulesSettings settings) throws IOException {
152     this.settings = settings;
153     this.stub = ((ForwardingRulesStubSettings) settings.getStubSettings()).createStub();
154   }
155 
ForwardingRulesClient(ForwardingRulesStub stub)156   protected ForwardingRulesClient(ForwardingRulesStub stub) {
157     this.settings = null;
158     this.stub = stub;
159   }
160 
getSettings()161   public final ForwardingRulesSettings getSettings() {
162     return settings;
163   }
164 
getStub()165   public ForwardingRulesStub getStub() {
166     return stub;
167   }
168 
169   // AUTO-GENERATED DOCUMENTATION AND METHOD.
170   /**
171    * Retrieves an aggregated list of forwarding rules.
172    *
173    * <p>Sample code:
174    *
175    * <pre>{@code
176    * // This snippet has been automatically generated and should be regarded as a code template only.
177    * // It will require modifications to work:
178    * // - It may require correct/in-range values for request initialization.
179    * // - It may require specifying regional endpoints when creating the service client as shown in
180    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
181    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
182    *   String project = "project-309310695";
183    *   for (Map.Entry<String, ForwardingRulesScopedList> element :
184    *       forwardingRulesClient.aggregatedList(project).iterateAll()) {
185    *     // doThingsWith(element);
186    *   }
187    * }
188    * }</pre>
189    *
190    * @param project Project ID for this request.
191    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
192    */
aggregatedList(String project)193   public final AggregatedListPagedResponse aggregatedList(String project) {
194     AggregatedListForwardingRulesRequest request =
195         AggregatedListForwardingRulesRequest.newBuilder().setProject(project).build();
196     return aggregatedList(request);
197   }
198 
199   // AUTO-GENERATED DOCUMENTATION AND METHOD.
200   /**
201    * Retrieves an aggregated list of forwarding rules.
202    *
203    * <p>Sample code:
204    *
205    * <pre>{@code
206    * // This snippet has been automatically generated and should be regarded as a code template only.
207    * // It will require modifications to work:
208    * // - It may require correct/in-range values for request initialization.
209    * // - It may require specifying regional endpoints when creating the service client as shown in
210    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
211    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
212    *   AggregatedListForwardingRulesRequest request =
213    *       AggregatedListForwardingRulesRequest.newBuilder()
214    *           .setFilter("filter-1274492040")
215    *           .setIncludeAllScopes(true)
216    *           .setMaxResults(1128457243)
217    *           .setOrderBy("orderBy-1207110587")
218    *           .setPageToken("pageToken873572522")
219    *           .setProject("project-309310695")
220    *           .setReturnPartialSuccess(true)
221    *           .build();
222    *   for (Map.Entry<String, ForwardingRulesScopedList> element :
223    *       forwardingRulesClient.aggregatedList(request).iterateAll()) {
224    *     // doThingsWith(element);
225    *   }
226    * }
227    * }</pre>
228    *
229    * @param request The request object containing all of the parameters for the API call.
230    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
231    */
aggregatedList( AggregatedListForwardingRulesRequest request)232   public final AggregatedListPagedResponse aggregatedList(
233       AggregatedListForwardingRulesRequest request) {
234     return aggregatedListPagedCallable().call(request);
235   }
236 
237   // AUTO-GENERATED DOCUMENTATION AND METHOD.
238   /**
239    * Retrieves an aggregated list of forwarding rules.
240    *
241    * <p>Sample code:
242    *
243    * <pre>{@code
244    * // This snippet has been automatically generated and should be regarded as a code template only.
245    * // It will require modifications to work:
246    * // - It may require correct/in-range values for request initialization.
247    * // - It may require specifying regional endpoints when creating the service client as shown in
248    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
249    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
250    *   AggregatedListForwardingRulesRequest request =
251    *       AggregatedListForwardingRulesRequest.newBuilder()
252    *           .setFilter("filter-1274492040")
253    *           .setIncludeAllScopes(true)
254    *           .setMaxResults(1128457243)
255    *           .setOrderBy("orderBy-1207110587")
256    *           .setPageToken("pageToken873572522")
257    *           .setProject("project-309310695")
258    *           .setReturnPartialSuccess(true)
259    *           .build();
260    *   ApiFuture<Map.Entry<String, ForwardingRulesScopedList>> future =
261    *       forwardingRulesClient.aggregatedListPagedCallable().futureCall(request);
262    *   // Do something.
263    *   for (Map.Entry<String, ForwardingRulesScopedList> element : future.get().iterateAll()) {
264    *     // doThingsWith(element);
265    *   }
266    * }
267    * }</pre>
268    */
269   public final UnaryCallable<AggregatedListForwardingRulesRequest, AggregatedListPagedResponse>
aggregatedListPagedCallable()270       aggregatedListPagedCallable() {
271     return stub.aggregatedListPagedCallable();
272   }
273 
274   // AUTO-GENERATED DOCUMENTATION AND METHOD.
275   /**
276    * Retrieves an aggregated list of forwarding rules.
277    *
278    * <p>Sample code:
279    *
280    * <pre>{@code
281    * // This snippet has been automatically generated and should be regarded as a code template only.
282    * // It will require modifications to work:
283    * // - It may require correct/in-range values for request initialization.
284    * // - It may require specifying regional endpoints when creating the service client as shown in
285    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
286    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
287    *   AggregatedListForwardingRulesRequest request =
288    *       AggregatedListForwardingRulesRequest.newBuilder()
289    *           .setFilter("filter-1274492040")
290    *           .setIncludeAllScopes(true)
291    *           .setMaxResults(1128457243)
292    *           .setOrderBy("orderBy-1207110587")
293    *           .setPageToken("pageToken873572522")
294    *           .setProject("project-309310695")
295    *           .setReturnPartialSuccess(true)
296    *           .build();
297    *   while (true) {
298    *     ForwardingRuleAggregatedList response =
299    *         forwardingRulesClient.aggregatedListCallable().call(request);
300    *     for (Map.Entry<String, ForwardingRulesScopedList> element : response.getItemsList()) {
301    *       // doThingsWith(element);
302    *     }
303    *     String nextPageToken = response.getNextPageToken();
304    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
305    *       request = request.toBuilder().setPageToken(nextPageToken).build();
306    *     } else {
307    *       break;
308    *     }
309    *   }
310    * }
311    * }</pre>
312    */
313   public final UnaryCallable<AggregatedListForwardingRulesRequest, ForwardingRuleAggregatedList>
aggregatedListCallable()314       aggregatedListCallable() {
315     return stub.aggregatedListCallable();
316   }
317 
318   // AUTO-GENERATED DOCUMENTATION AND METHOD.
319   /**
320    * Deletes the specified ForwardingRule resource.
321    *
322    * <p>Sample code:
323    *
324    * <pre>{@code
325    * // This snippet has been automatically generated and should be regarded as a code template only.
326    * // It will require modifications to work:
327    * // - It may require correct/in-range values for request initialization.
328    * // - It may require specifying regional endpoints when creating the service client as shown in
329    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
330    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
331    *   String project = "project-309310695";
332    *   String region = "region-934795532";
333    *   String forwardingRule = "forwardingRule-1429104743";
334    *   Operation response = forwardingRulesClient.deleteAsync(project, region, forwardingRule).get();
335    * }
336    * }</pre>
337    *
338    * @param project Project ID for this request.
339    * @param region Name of the region scoping this request.
340    * @param forwardingRule Name of the ForwardingRule resource to delete.
341    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
342    */
deleteAsync( String project, String region, String forwardingRule)343   public final OperationFuture<Operation, Operation> deleteAsync(
344       String project, String region, String forwardingRule) {
345     DeleteForwardingRuleRequest request =
346         DeleteForwardingRuleRequest.newBuilder()
347             .setProject(project)
348             .setRegion(region)
349             .setForwardingRule(forwardingRule)
350             .build();
351     return deleteAsync(request);
352   }
353 
354   // AUTO-GENERATED DOCUMENTATION AND METHOD.
355   /**
356    * Deletes the specified ForwardingRule resource.
357    *
358    * <p>Sample code:
359    *
360    * <pre>{@code
361    * // This snippet has been automatically generated and should be regarded as a code template only.
362    * // It will require modifications to work:
363    * // - It may require correct/in-range values for request initialization.
364    * // - It may require specifying regional endpoints when creating the service client as shown in
365    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
366    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
367    *   DeleteForwardingRuleRequest request =
368    *       DeleteForwardingRuleRequest.newBuilder()
369    *           .setForwardingRule("forwardingRule-1429104743")
370    *           .setProject("project-309310695")
371    *           .setRegion("region-934795532")
372    *           .setRequestId("requestId693933066")
373    *           .build();
374    *   Operation response = forwardingRulesClient.deleteAsync(request).get();
375    * }
376    * }</pre>
377    *
378    * @param request The request object containing all of the parameters for the API call.
379    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
380    */
381   @BetaApi(
382       "The surface for long-running operations is not stable yet and may change in the future.")
deleteAsync( DeleteForwardingRuleRequest request)383   public final OperationFuture<Operation, Operation> deleteAsync(
384       DeleteForwardingRuleRequest request) {
385     return deleteOperationCallable().futureCall(request);
386   }
387 
388   // AUTO-GENERATED DOCUMENTATION AND METHOD.
389   /**
390    * Deletes the specified ForwardingRule resource.
391    *
392    * <p>Sample code:
393    *
394    * <pre>{@code
395    * // This snippet has been automatically generated and should be regarded as a code template only.
396    * // It will require modifications to work:
397    * // - It may require correct/in-range values for request initialization.
398    * // - It may require specifying regional endpoints when creating the service client as shown in
399    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
400    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
401    *   DeleteForwardingRuleRequest request =
402    *       DeleteForwardingRuleRequest.newBuilder()
403    *           .setForwardingRule("forwardingRule-1429104743")
404    *           .setProject("project-309310695")
405    *           .setRegion("region-934795532")
406    *           .setRequestId("requestId693933066")
407    *           .build();
408    *   OperationFuture<Operation, Operation> future =
409    *       forwardingRulesClient.deleteOperationCallable().futureCall(request);
410    *   // Do something.
411    *   Operation response = future.get();
412    * }
413    * }</pre>
414    */
415   public final OperationCallable<DeleteForwardingRuleRequest, Operation, Operation>
deleteOperationCallable()416       deleteOperationCallable() {
417     return stub.deleteOperationCallable();
418   }
419 
420   // AUTO-GENERATED DOCUMENTATION AND METHOD.
421   /**
422    * Deletes the specified ForwardingRule resource.
423    *
424    * <p>Sample code:
425    *
426    * <pre>{@code
427    * // This snippet has been automatically generated and should be regarded as a code template only.
428    * // It will require modifications to work:
429    * // - It may require correct/in-range values for request initialization.
430    * // - It may require specifying regional endpoints when creating the service client as shown in
431    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
432    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
433    *   DeleteForwardingRuleRequest request =
434    *       DeleteForwardingRuleRequest.newBuilder()
435    *           .setForwardingRule("forwardingRule-1429104743")
436    *           .setProject("project-309310695")
437    *           .setRegion("region-934795532")
438    *           .setRequestId("requestId693933066")
439    *           .build();
440    *   ApiFuture<Operation> future = forwardingRulesClient.deleteCallable().futureCall(request);
441    *   // Do something.
442    *   Operation response = future.get();
443    * }
444    * }</pre>
445    */
deleteCallable()446   public final UnaryCallable<DeleteForwardingRuleRequest, Operation> deleteCallable() {
447     return stub.deleteCallable();
448   }
449 
450   // AUTO-GENERATED DOCUMENTATION AND METHOD.
451   /**
452    * Returns the specified ForwardingRule resource.
453    *
454    * <p>Sample code:
455    *
456    * <pre>{@code
457    * // This snippet has been automatically generated and should be regarded as a code template only.
458    * // It will require modifications to work:
459    * // - It may require correct/in-range values for request initialization.
460    * // - It may require specifying regional endpoints when creating the service client as shown in
461    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
462    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
463    *   String project = "project-309310695";
464    *   String region = "region-934795532";
465    *   String forwardingRule = "forwardingRule-1429104743";
466    *   ForwardingRule response = forwardingRulesClient.get(project, region, forwardingRule);
467    * }
468    * }</pre>
469    *
470    * @param project Project ID for this request.
471    * @param region Name of the region scoping this request.
472    * @param forwardingRule Name of the ForwardingRule resource to return.
473    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
474    */
get(String project, String region, String forwardingRule)475   public final ForwardingRule get(String project, String region, String forwardingRule) {
476     GetForwardingRuleRequest request =
477         GetForwardingRuleRequest.newBuilder()
478             .setProject(project)
479             .setRegion(region)
480             .setForwardingRule(forwardingRule)
481             .build();
482     return get(request);
483   }
484 
485   // AUTO-GENERATED DOCUMENTATION AND METHOD.
486   /**
487    * Returns the specified ForwardingRule resource.
488    *
489    * <p>Sample code:
490    *
491    * <pre>{@code
492    * // This snippet has been automatically generated and should be regarded as a code template only.
493    * // It will require modifications to work:
494    * // - It may require correct/in-range values for request initialization.
495    * // - It may require specifying regional endpoints when creating the service client as shown in
496    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
497    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
498    *   GetForwardingRuleRequest request =
499    *       GetForwardingRuleRequest.newBuilder()
500    *           .setForwardingRule("forwardingRule-1429104743")
501    *           .setProject("project-309310695")
502    *           .setRegion("region-934795532")
503    *           .build();
504    *   ForwardingRule response = forwardingRulesClient.get(request);
505    * }
506    * }</pre>
507    *
508    * @param request The request object containing all of the parameters for the API call.
509    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
510    */
get(GetForwardingRuleRequest request)511   public final ForwardingRule get(GetForwardingRuleRequest request) {
512     return getCallable().call(request);
513   }
514 
515   // AUTO-GENERATED DOCUMENTATION AND METHOD.
516   /**
517    * Returns the specified ForwardingRule resource.
518    *
519    * <p>Sample code:
520    *
521    * <pre>{@code
522    * // This snippet has been automatically generated and should be regarded as a code template only.
523    * // It will require modifications to work:
524    * // - It may require correct/in-range values for request initialization.
525    * // - It may require specifying regional endpoints when creating the service client as shown in
526    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
527    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
528    *   GetForwardingRuleRequest request =
529    *       GetForwardingRuleRequest.newBuilder()
530    *           .setForwardingRule("forwardingRule-1429104743")
531    *           .setProject("project-309310695")
532    *           .setRegion("region-934795532")
533    *           .build();
534    *   ApiFuture<ForwardingRule> future = forwardingRulesClient.getCallable().futureCall(request);
535    *   // Do something.
536    *   ForwardingRule response = future.get();
537    * }
538    * }</pre>
539    */
getCallable()540   public final UnaryCallable<GetForwardingRuleRequest, ForwardingRule> getCallable() {
541     return stub.getCallable();
542   }
543 
544   // AUTO-GENERATED DOCUMENTATION AND METHOD.
545   /**
546    * Creates a ForwardingRule resource in the specified project and region using the data included
547    * in the request.
548    *
549    * <p>Sample code:
550    *
551    * <pre>{@code
552    * // This snippet has been automatically generated and should be regarded as a code template only.
553    * // It will require modifications to work:
554    * // - It may require correct/in-range values for request initialization.
555    * // - It may require specifying regional endpoints when creating the service client as shown in
556    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
557    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
558    *   String project = "project-309310695";
559    *   String region = "region-934795532";
560    *   ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
561    *   Operation response =
562    *       forwardingRulesClient.insertAsync(project, region, forwardingRuleResource).get();
563    * }
564    * }</pre>
565    *
566    * @param project Project ID for this request.
567    * @param region Name of the region scoping this request.
568    * @param forwardingRuleResource The body resource for this request
569    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
570    */
insertAsync( String project, String region, ForwardingRule forwardingRuleResource)571   public final OperationFuture<Operation, Operation> insertAsync(
572       String project, String region, ForwardingRule forwardingRuleResource) {
573     InsertForwardingRuleRequest request =
574         InsertForwardingRuleRequest.newBuilder()
575             .setProject(project)
576             .setRegion(region)
577             .setForwardingRuleResource(forwardingRuleResource)
578             .build();
579     return insertAsync(request);
580   }
581 
582   // AUTO-GENERATED DOCUMENTATION AND METHOD.
583   /**
584    * Creates a ForwardingRule resource in the specified project and region using the data included
585    * in the request.
586    *
587    * <p>Sample code:
588    *
589    * <pre>{@code
590    * // This snippet has been automatically generated and should be regarded as a code template only.
591    * // It will require modifications to work:
592    * // - It may require correct/in-range values for request initialization.
593    * // - It may require specifying regional endpoints when creating the service client as shown in
594    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
595    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
596    *   InsertForwardingRuleRequest request =
597    *       InsertForwardingRuleRequest.newBuilder()
598    *           .setForwardingRuleResource(ForwardingRule.newBuilder().build())
599    *           .setProject("project-309310695")
600    *           .setRegion("region-934795532")
601    *           .setRequestId("requestId693933066")
602    *           .build();
603    *   Operation response = forwardingRulesClient.insertAsync(request).get();
604    * }
605    * }</pre>
606    *
607    * @param request The request object containing all of the parameters for the API call.
608    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
609    */
610   @BetaApi(
611       "The surface for long-running operations is not stable yet and may change in the future.")
insertAsync( InsertForwardingRuleRequest request)612   public final OperationFuture<Operation, Operation> insertAsync(
613       InsertForwardingRuleRequest request) {
614     return insertOperationCallable().futureCall(request);
615   }
616 
617   // AUTO-GENERATED DOCUMENTATION AND METHOD.
618   /**
619    * Creates a ForwardingRule resource in the specified project and region using the data included
620    * in the request.
621    *
622    * <p>Sample code:
623    *
624    * <pre>{@code
625    * // This snippet has been automatically generated and should be regarded as a code template only.
626    * // It will require modifications to work:
627    * // - It may require correct/in-range values for request initialization.
628    * // - It may require specifying regional endpoints when creating the service client as shown in
629    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
630    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
631    *   InsertForwardingRuleRequest request =
632    *       InsertForwardingRuleRequest.newBuilder()
633    *           .setForwardingRuleResource(ForwardingRule.newBuilder().build())
634    *           .setProject("project-309310695")
635    *           .setRegion("region-934795532")
636    *           .setRequestId("requestId693933066")
637    *           .build();
638    *   OperationFuture<Operation, Operation> future =
639    *       forwardingRulesClient.insertOperationCallable().futureCall(request);
640    *   // Do something.
641    *   Operation response = future.get();
642    * }
643    * }</pre>
644    */
645   public final OperationCallable<InsertForwardingRuleRequest, Operation, Operation>
insertOperationCallable()646       insertOperationCallable() {
647     return stub.insertOperationCallable();
648   }
649 
650   // AUTO-GENERATED DOCUMENTATION AND METHOD.
651   /**
652    * Creates a ForwardingRule resource in the specified project and region using the data included
653    * in the request.
654    *
655    * <p>Sample code:
656    *
657    * <pre>{@code
658    * // This snippet has been automatically generated and should be regarded as a code template only.
659    * // It will require modifications to work:
660    * // - It may require correct/in-range values for request initialization.
661    * // - It may require specifying regional endpoints when creating the service client as shown in
662    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
663    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
664    *   InsertForwardingRuleRequest request =
665    *       InsertForwardingRuleRequest.newBuilder()
666    *           .setForwardingRuleResource(ForwardingRule.newBuilder().build())
667    *           .setProject("project-309310695")
668    *           .setRegion("region-934795532")
669    *           .setRequestId("requestId693933066")
670    *           .build();
671    *   ApiFuture<Operation> future = forwardingRulesClient.insertCallable().futureCall(request);
672    *   // Do something.
673    *   Operation response = future.get();
674    * }
675    * }</pre>
676    */
insertCallable()677   public final UnaryCallable<InsertForwardingRuleRequest, Operation> insertCallable() {
678     return stub.insertCallable();
679   }
680 
681   // AUTO-GENERATED DOCUMENTATION AND METHOD.
682   /**
683    * Retrieves a list of ForwardingRule resources available to the specified project and region.
684    *
685    * <p>Sample code:
686    *
687    * <pre>{@code
688    * // This snippet has been automatically generated and should be regarded as a code template only.
689    * // It will require modifications to work:
690    * // - It may require correct/in-range values for request initialization.
691    * // - It may require specifying regional endpoints when creating the service client as shown in
692    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
693    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
694    *   String project = "project-309310695";
695    *   String region = "region-934795532";
696    *   for (ForwardingRule element : forwardingRulesClient.list(project, region).iterateAll()) {
697    *     // doThingsWith(element);
698    *   }
699    * }
700    * }</pre>
701    *
702    * @param project Project ID for this request.
703    * @param region Name of the region scoping this request.
704    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
705    */
list(String project, String region)706   public final ListPagedResponse list(String project, String region) {
707     ListForwardingRulesRequest request =
708         ListForwardingRulesRequest.newBuilder().setProject(project).setRegion(region).build();
709     return list(request);
710   }
711 
712   // AUTO-GENERATED DOCUMENTATION AND METHOD.
713   /**
714    * Retrieves a list of ForwardingRule resources available to the specified project and region.
715    *
716    * <p>Sample code:
717    *
718    * <pre>{@code
719    * // This snippet has been automatically generated and should be regarded as a code template only.
720    * // It will require modifications to work:
721    * // - It may require correct/in-range values for request initialization.
722    * // - It may require specifying regional endpoints when creating the service client as shown in
723    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
724    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
725    *   ListForwardingRulesRequest request =
726    *       ListForwardingRulesRequest.newBuilder()
727    *           .setFilter("filter-1274492040")
728    *           .setMaxResults(1128457243)
729    *           .setOrderBy("orderBy-1207110587")
730    *           .setPageToken("pageToken873572522")
731    *           .setProject("project-309310695")
732    *           .setRegion("region-934795532")
733    *           .setReturnPartialSuccess(true)
734    *           .build();
735    *   for (ForwardingRule element : forwardingRulesClient.list(request).iterateAll()) {
736    *     // doThingsWith(element);
737    *   }
738    * }
739    * }</pre>
740    *
741    * @param request The request object containing all of the parameters for the API call.
742    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
743    */
list(ListForwardingRulesRequest request)744   public final ListPagedResponse list(ListForwardingRulesRequest request) {
745     return listPagedCallable().call(request);
746   }
747 
748   // AUTO-GENERATED DOCUMENTATION AND METHOD.
749   /**
750    * Retrieves a list of ForwardingRule resources available to the specified project and region.
751    *
752    * <p>Sample code:
753    *
754    * <pre>{@code
755    * // This snippet has been automatically generated and should be regarded as a code template only.
756    * // It will require modifications to work:
757    * // - It may require correct/in-range values for request initialization.
758    * // - It may require specifying regional endpoints when creating the service client as shown in
759    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
760    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
761    *   ListForwardingRulesRequest request =
762    *       ListForwardingRulesRequest.newBuilder()
763    *           .setFilter("filter-1274492040")
764    *           .setMaxResults(1128457243)
765    *           .setOrderBy("orderBy-1207110587")
766    *           .setPageToken("pageToken873572522")
767    *           .setProject("project-309310695")
768    *           .setRegion("region-934795532")
769    *           .setReturnPartialSuccess(true)
770    *           .build();
771    *   ApiFuture<ForwardingRule> future =
772    *       forwardingRulesClient.listPagedCallable().futureCall(request);
773    *   // Do something.
774    *   for (ForwardingRule element : future.get().iterateAll()) {
775    *     // doThingsWith(element);
776    *   }
777    * }
778    * }</pre>
779    */
listPagedCallable()780   public final UnaryCallable<ListForwardingRulesRequest, ListPagedResponse> listPagedCallable() {
781     return stub.listPagedCallable();
782   }
783 
784   // AUTO-GENERATED DOCUMENTATION AND METHOD.
785   /**
786    * Retrieves a list of ForwardingRule resources available to the specified project and region.
787    *
788    * <p>Sample code:
789    *
790    * <pre>{@code
791    * // This snippet has been automatically generated and should be regarded as a code template only.
792    * // It will require modifications to work:
793    * // - It may require correct/in-range values for request initialization.
794    * // - It may require specifying regional endpoints when creating the service client as shown in
795    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
796    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
797    *   ListForwardingRulesRequest request =
798    *       ListForwardingRulesRequest.newBuilder()
799    *           .setFilter("filter-1274492040")
800    *           .setMaxResults(1128457243)
801    *           .setOrderBy("orderBy-1207110587")
802    *           .setPageToken("pageToken873572522")
803    *           .setProject("project-309310695")
804    *           .setRegion("region-934795532")
805    *           .setReturnPartialSuccess(true)
806    *           .build();
807    *   while (true) {
808    *     ForwardingRuleList response = forwardingRulesClient.listCallable().call(request);
809    *     for (ForwardingRule element : response.getItemsList()) {
810    *       // doThingsWith(element);
811    *     }
812    *     String nextPageToken = response.getNextPageToken();
813    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
814    *       request = request.toBuilder().setPageToken(nextPageToken).build();
815    *     } else {
816    *       break;
817    *     }
818    *   }
819    * }
820    * }</pre>
821    */
listCallable()822   public final UnaryCallable<ListForwardingRulesRequest, ForwardingRuleList> listCallable() {
823     return stub.listCallable();
824   }
825 
826   // AUTO-GENERATED DOCUMENTATION AND METHOD.
827   /**
828    * Updates the specified forwarding rule with the data included in the request. This method
829    * supports PATCH semantics and uses the JSON merge patch format and processing rules. Currently,
830    * you can only patch the network_tier field.
831    *
832    * <p>Sample code:
833    *
834    * <pre>{@code
835    * // This snippet has been automatically generated and should be regarded as a code template only.
836    * // It will require modifications to work:
837    * // - It may require correct/in-range values for request initialization.
838    * // - It may require specifying regional endpoints when creating the service client as shown in
839    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
840    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
841    *   String project = "project-309310695";
842    *   String region = "region-934795532";
843    *   String forwardingRule = "forwardingRule-1429104743";
844    *   ForwardingRule forwardingRuleResource = ForwardingRule.newBuilder().build();
845    *   Operation response =
846    *       forwardingRulesClient
847    *           .patchAsync(project, region, forwardingRule, forwardingRuleResource)
848    *           .get();
849    * }
850    * }</pre>
851    *
852    * @param project Project ID for this request.
853    * @param region Name of the region scoping this request.
854    * @param forwardingRule Name of the ForwardingRule resource to patch.
855    * @param forwardingRuleResource The body resource for this request
856    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
857    */
patchAsync( String project, String region, String forwardingRule, ForwardingRule forwardingRuleResource)858   public final OperationFuture<Operation, Operation> patchAsync(
859       String project, String region, String forwardingRule, ForwardingRule forwardingRuleResource) {
860     PatchForwardingRuleRequest request =
861         PatchForwardingRuleRequest.newBuilder()
862             .setProject(project)
863             .setRegion(region)
864             .setForwardingRule(forwardingRule)
865             .setForwardingRuleResource(forwardingRuleResource)
866             .build();
867     return patchAsync(request);
868   }
869 
870   // AUTO-GENERATED DOCUMENTATION AND METHOD.
871   /**
872    * Updates the specified forwarding rule with the data included in the request. This method
873    * supports PATCH semantics and uses the JSON merge patch format and processing rules. Currently,
874    * you can only patch the network_tier field.
875    *
876    * <p>Sample code:
877    *
878    * <pre>{@code
879    * // This snippet has been automatically generated and should be regarded as a code template only.
880    * // It will require modifications to work:
881    * // - It may require correct/in-range values for request initialization.
882    * // - It may require specifying regional endpoints when creating the service client as shown in
883    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
884    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
885    *   PatchForwardingRuleRequest request =
886    *       PatchForwardingRuleRequest.newBuilder()
887    *           .setForwardingRule("forwardingRule-1429104743")
888    *           .setForwardingRuleResource(ForwardingRule.newBuilder().build())
889    *           .setProject("project-309310695")
890    *           .setRegion("region-934795532")
891    *           .setRequestId("requestId693933066")
892    *           .build();
893    *   Operation response = forwardingRulesClient.patchAsync(request).get();
894    * }
895    * }</pre>
896    *
897    * @param request The request object containing all of the parameters for the API call.
898    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
899    */
900   @BetaApi(
901       "The surface for long-running operations is not stable yet and may change in the future.")
patchAsync( PatchForwardingRuleRequest request)902   public final OperationFuture<Operation, Operation> patchAsync(
903       PatchForwardingRuleRequest request) {
904     return patchOperationCallable().futureCall(request);
905   }
906 
907   // AUTO-GENERATED DOCUMENTATION AND METHOD.
908   /**
909    * Updates the specified forwarding rule with the data included in the request. This method
910    * supports PATCH semantics and uses the JSON merge patch format and processing rules. Currently,
911    * you can only patch the network_tier field.
912    *
913    * <p>Sample code:
914    *
915    * <pre>{@code
916    * // This snippet has been automatically generated and should be regarded as a code template only.
917    * // It will require modifications to work:
918    * // - It may require correct/in-range values for request initialization.
919    * // - It may require specifying regional endpoints when creating the service client as shown in
920    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
921    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
922    *   PatchForwardingRuleRequest request =
923    *       PatchForwardingRuleRequest.newBuilder()
924    *           .setForwardingRule("forwardingRule-1429104743")
925    *           .setForwardingRuleResource(ForwardingRule.newBuilder().build())
926    *           .setProject("project-309310695")
927    *           .setRegion("region-934795532")
928    *           .setRequestId("requestId693933066")
929    *           .build();
930    *   OperationFuture<Operation, Operation> future =
931    *       forwardingRulesClient.patchOperationCallable().futureCall(request);
932    *   // Do something.
933    *   Operation response = future.get();
934    * }
935    * }</pre>
936    */
937   public final OperationCallable<PatchForwardingRuleRequest, Operation, Operation>
patchOperationCallable()938       patchOperationCallable() {
939     return stub.patchOperationCallable();
940   }
941 
942   // AUTO-GENERATED DOCUMENTATION AND METHOD.
943   /**
944    * Updates the specified forwarding rule with the data included in the request. This method
945    * supports PATCH semantics and uses the JSON merge patch format and processing rules. Currently,
946    * you can only patch the network_tier field.
947    *
948    * <p>Sample code:
949    *
950    * <pre>{@code
951    * // This snippet has been automatically generated and should be regarded as a code template only.
952    * // It will require modifications to work:
953    * // - It may require correct/in-range values for request initialization.
954    * // - It may require specifying regional endpoints when creating the service client as shown in
955    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
956    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
957    *   PatchForwardingRuleRequest request =
958    *       PatchForwardingRuleRequest.newBuilder()
959    *           .setForwardingRule("forwardingRule-1429104743")
960    *           .setForwardingRuleResource(ForwardingRule.newBuilder().build())
961    *           .setProject("project-309310695")
962    *           .setRegion("region-934795532")
963    *           .setRequestId("requestId693933066")
964    *           .build();
965    *   ApiFuture<Operation> future = forwardingRulesClient.patchCallable().futureCall(request);
966    *   // Do something.
967    *   Operation response = future.get();
968    * }
969    * }</pre>
970    */
patchCallable()971   public final UnaryCallable<PatchForwardingRuleRequest, Operation> patchCallable() {
972     return stub.patchCallable();
973   }
974 
975   // AUTO-GENERATED DOCUMENTATION AND METHOD.
976   /**
977    * Sets the labels on the specified resource. To learn more about labels, read the Labeling
978    * Resources documentation.
979    *
980    * <p>Sample code:
981    *
982    * <pre>{@code
983    * // This snippet has been automatically generated and should be regarded as a code template only.
984    * // It will require modifications to work:
985    * // - It may require correct/in-range values for request initialization.
986    * // - It may require specifying regional endpoints when creating the service client as shown in
987    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
988    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
989    *   String project = "project-309310695";
990    *   String region = "region-934795532";
991    *   String resource = "resource-341064690";
992    *   RegionSetLabelsRequest regionSetLabelsRequestResource =
993    *       RegionSetLabelsRequest.newBuilder().build();
994    *   Operation response =
995    *       forwardingRulesClient
996    *           .setLabelsAsync(project, region, resource, regionSetLabelsRequestResource)
997    *           .get();
998    * }
999    * }</pre>
1000    *
1001    * @param project Project ID for this request.
1002    * @param region The region for this request.
1003    * @param resource Name or id of the resource for this request.
1004    * @param regionSetLabelsRequestResource The body resource for this request
1005    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1006    */
setLabelsAsync( String project, String region, String resource, RegionSetLabelsRequest regionSetLabelsRequestResource)1007   public final OperationFuture<Operation, Operation> setLabelsAsync(
1008       String project,
1009       String region,
1010       String resource,
1011       RegionSetLabelsRequest regionSetLabelsRequestResource) {
1012     SetLabelsForwardingRuleRequest request =
1013         SetLabelsForwardingRuleRequest.newBuilder()
1014             .setProject(project)
1015             .setRegion(region)
1016             .setResource(resource)
1017             .setRegionSetLabelsRequestResource(regionSetLabelsRequestResource)
1018             .build();
1019     return setLabelsAsync(request);
1020   }
1021 
1022   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1023   /**
1024    * Sets the labels on the specified resource. To learn more about labels, read the Labeling
1025    * Resources documentation.
1026    *
1027    * <p>Sample code:
1028    *
1029    * <pre>{@code
1030    * // This snippet has been automatically generated and should be regarded as a code template only.
1031    * // It will require modifications to work:
1032    * // - It may require correct/in-range values for request initialization.
1033    * // - It may require specifying regional endpoints when creating the service client as shown in
1034    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1035    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
1036    *   SetLabelsForwardingRuleRequest request =
1037    *       SetLabelsForwardingRuleRequest.newBuilder()
1038    *           .setProject("project-309310695")
1039    *           .setRegion("region-934795532")
1040    *           .setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build())
1041    *           .setRequestId("requestId693933066")
1042    *           .setResource("resource-341064690")
1043    *           .build();
1044    *   Operation response = forwardingRulesClient.setLabelsAsync(request).get();
1045    * }
1046    * }</pre>
1047    *
1048    * @param request The request object containing all of the parameters for the API call.
1049    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1050    */
1051   @BetaApi(
1052       "The surface for long-running operations is not stable yet and may change in the future.")
setLabelsAsync( SetLabelsForwardingRuleRequest request)1053   public final OperationFuture<Operation, Operation> setLabelsAsync(
1054       SetLabelsForwardingRuleRequest request) {
1055     return setLabelsOperationCallable().futureCall(request);
1056   }
1057 
1058   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1059   /**
1060    * Sets the labels on the specified resource. To learn more about labels, read the Labeling
1061    * Resources documentation.
1062    *
1063    * <p>Sample code:
1064    *
1065    * <pre>{@code
1066    * // This snippet has been automatically generated and should be regarded as a code template only.
1067    * // It will require modifications to work:
1068    * // - It may require correct/in-range values for request initialization.
1069    * // - It may require specifying regional endpoints when creating the service client as shown in
1070    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1071    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
1072    *   SetLabelsForwardingRuleRequest request =
1073    *       SetLabelsForwardingRuleRequest.newBuilder()
1074    *           .setProject("project-309310695")
1075    *           .setRegion("region-934795532")
1076    *           .setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build())
1077    *           .setRequestId("requestId693933066")
1078    *           .setResource("resource-341064690")
1079    *           .build();
1080    *   OperationFuture<Operation, Operation> future =
1081    *       forwardingRulesClient.setLabelsOperationCallable().futureCall(request);
1082    *   // Do something.
1083    *   Operation response = future.get();
1084    * }
1085    * }</pre>
1086    */
1087   public final OperationCallable<SetLabelsForwardingRuleRequest, Operation, Operation>
setLabelsOperationCallable()1088       setLabelsOperationCallable() {
1089     return stub.setLabelsOperationCallable();
1090   }
1091 
1092   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1093   /**
1094    * Sets the labels on the specified resource. To learn more about labels, read the Labeling
1095    * Resources documentation.
1096    *
1097    * <p>Sample code:
1098    *
1099    * <pre>{@code
1100    * // This snippet has been automatically generated and should be regarded as a code template only.
1101    * // It will require modifications to work:
1102    * // - It may require correct/in-range values for request initialization.
1103    * // - It may require specifying regional endpoints when creating the service client as shown in
1104    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1105    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
1106    *   SetLabelsForwardingRuleRequest request =
1107    *       SetLabelsForwardingRuleRequest.newBuilder()
1108    *           .setProject("project-309310695")
1109    *           .setRegion("region-934795532")
1110    *           .setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build())
1111    *           .setRequestId("requestId693933066")
1112    *           .setResource("resource-341064690")
1113    *           .build();
1114    *   ApiFuture<Operation> future = forwardingRulesClient.setLabelsCallable().futureCall(request);
1115    *   // Do something.
1116    *   Operation response = future.get();
1117    * }
1118    * }</pre>
1119    */
setLabelsCallable()1120   public final UnaryCallable<SetLabelsForwardingRuleRequest, Operation> setLabelsCallable() {
1121     return stub.setLabelsCallable();
1122   }
1123 
1124   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1125   /**
1126    * Changes target URL for forwarding rule. The new target should be of the same type as the old
1127    * target.
1128    *
1129    * <p>Sample code:
1130    *
1131    * <pre>{@code
1132    * // This snippet has been automatically generated and should be regarded as a code template only.
1133    * // It will require modifications to work:
1134    * // - It may require correct/in-range values for request initialization.
1135    * // - It may require specifying regional endpoints when creating the service client as shown in
1136    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1137    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
1138    *   String project = "project-309310695";
1139    *   String region = "region-934795532";
1140    *   String forwardingRule = "forwardingRule-1429104743";
1141    *   TargetReference targetReferenceResource = TargetReference.newBuilder().build();
1142    *   Operation response =
1143    *       forwardingRulesClient
1144    *           .setTargetAsync(project, region, forwardingRule, targetReferenceResource)
1145    *           .get();
1146    * }
1147    * }</pre>
1148    *
1149    * @param project Project ID for this request.
1150    * @param region Name of the region scoping this request.
1151    * @param forwardingRule Name of the ForwardingRule resource in which target is to be set.
1152    * @param targetReferenceResource The body resource for this request
1153    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1154    */
setTargetAsync( String project, String region, String forwardingRule, TargetReference targetReferenceResource)1155   public final OperationFuture<Operation, Operation> setTargetAsync(
1156       String project,
1157       String region,
1158       String forwardingRule,
1159       TargetReference targetReferenceResource) {
1160     SetTargetForwardingRuleRequest request =
1161         SetTargetForwardingRuleRequest.newBuilder()
1162             .setProject(project)
1163             .setRegion(region)
1164             .setForwardingRule(forwardingRule)
1165             .setTargetReferenceResource(targetReferenceResource)
1166             .build();
1167     return setTargetAsync(request);
1168   }
1169 
1170   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1171   /**
1172    * Changes target URL for forwarding rule. The new target should be of the same type as the old
1173    * target.
1174    *
1175    * <p>Sample code:
1176    *
1177    * <pre>{@code
1178    * // This snippet has been automatically generated and should be regarded as a code template only.
1179    * // It will require modifications to work:
1180    * // - It may require correct/in-range values for request initialization.
1181    * // - It may require specifying regional endpoints when creating the service client as shown in
1182    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1183    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
1184    *   SetTargetForwardingRuleRequest request =
1185    *       SetTargetForwardingRuleRequest.newBuilder()
1186    *           .setForwardingRule("forwardingRule-1429104743")
1187    *           .setProject("project-309310695")
1188    *           .setRegion("region-934795532")
1189    *           .setRequestId("requestId693933066")
1190    *           .setTargetReferenceResource(TargetReference.newBuilder().build())
1191    *           .build();
1192    *   Operation response = forwardingRulesClient.setTargetAsync(request).get();
1193    * }
1194    * }</pre>
1195    *
1196    * @param request The request object containing all of the parameters for the API call.
1197    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1198    */
1199   @BetaApi(
1200       "The surface for long-running operations is not stable yet and may change in the future.")
setTargetAsync( SetTargetForwardingRuleRequest request)1201   public final OperationFuture<Operation, Operation> setTargetAsync(
1202       SetTargetForwardingRuleRequest request) {
1203     return setTargetOperationCallable().futureCall(request);
1204   }
1205 
1206   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1207   /**
1208    * Changes target URL for forwarding rule. The new target should be of the same type as the old
1209    * target.
1210    *
1211    * <p>Sample code:
1212    *
1213    * <pre>{@code
1214    * // This snippet has been automatically generated and should be regarded as a code template only.
1215    * // It will require modifications to work:
1216    * // - It may require correct/in-range values for request initialization.
1217    * // - It may require specifying regional endpoints when creating the service client as shown in
1218    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1219    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
1220    *   SetTargetForwardingRuleRequest request =
1221    *       SetTargetForwardingRuleRequest.newBuilder()
1222    *           .setForwardingRule("forwardingRule-1429104743")
1223    *           .setProject("project-309310695")
1224    *           .setRegion("region-934795532")
1225    *           .setRequestId("requestId693933066")
1226    *           .setTargetReferenceResource(TargetReference.newBuilder().build())
1227    *           .build();
1228    *   OperationFuture<Operation, Operation> future =
1229    *       forwardingRulesClient.setTargetOperationCallable().futureCall(request);
1230    *   // Do something.
1231    *   Operation response = future.get();
1232    * }
1233    * }</pre>
1234    */
1235   public final OperationCallable<SetTargetForwardingRuleRequest, Operation, Operation>
setTargetOperationCallable()1236       setTargetOperationCallable() {
1237     return stub.setTargetOperationCallable();
1238   }
1239 
1240   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1241   /**
1242    * Changes target URL for forwarding rule. The new target should be of the same type as the old
1243    * target.
1244    *
1245    * <p>Sample code:
1246    *
1247    * <pre>{@code
1248    * // This snippet has been automatically generated and should be regarded as a code template only.
1249    * // It will require modifications to work:
1250    * // - It may require correct/in-range values for request initialization.
1251    * // - It may require specifying regional endpoints when creating the service client as shown in
1252    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1253    * try (ForwardingRulesClient forwardingRulesClient = ForwardingRulesClient.create()) {
1254    *   SetTargetForwardingRuleRequest request =
1255    *       SetTargetForwardingRuleRequest.newBuilder()
1256    *           .setForwardingRule("forwardingRule-1429104743")
1257    *           .setProject("project-309310695")
1258    *           .setRegion("region-934795532")
1259    *           .setRequestId("requestId693933066")
1260    *           .setTargetReferenceResource(TargetReference.newBuilder().build())
1261    *           .build();
1262    *   ApiFuture<Operation> future = forwardingRulesClient.setTargetCallable().futureCall(request);
1263    *   // Do something.
1264    *   Operation response = future.get();
1265    * }
1266    * }</pre>
1267    */
setTargetCallable()1268   public final UnaryCallable<SetTargetForwardingRuleRequest, Operation> setTargetCallable() {
1269     return stub.setTargetCallable();
1270   }
1271 
1272   @Override
close()1273   public final void close() {
1274     stub.close();
1275   }
1276 
1277   @Override
shutdown()1278   public void shutdown() {
1279     stub.shutdown();
1280   }
1281 
1282   @Override
isShutdown()1283   public boolean isShutdown() {
1284     return stub.isShutdown();
1285   }
1286 
1287   @Override
isTerminated()1288   public boolean isTerminated() {
1289     return stub.isTerminated();
1290   }
1291 
1292   @Override
shutdownNow()1293   public void shutdownNow() {
1294     stub.shutdownNow();
1295   }
1296 
1297   @Override
awaitTermination(long duration, TimeUnit unit)1298   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
1299     return stub.awaitTermination(duration, unit);
1300   }
1301 
1302   public static class AggregatedListPagedResponse
1303       extends AbstractPagedListResponse<
1304           AggregatedListForwardingRulesRequest,
1305           ForwardingRuleAggregatedList,
1306           Map.Entry<String, ForwardingRulesScopedList>,
1307           AggregatedListPage,
1308           AggregatedListFixedSizeCollection> {
1309 
createAsync( PageContext< AggregatedListForwardingRulesRequest, ForwardingRuleAggregatedList, Map.Entry<String, ForwardingRulesScopedList>> context, ApiFuture<ForwardingRuleAggregatedList> futureResponse)1310     public static ApiFuture<AggregatedListPagedResponse> createAsync(
1311         PageContext<
1312                 AggregatedListForwardingRulesRequest,
1313                 ForwardingRuleAggregatedList,
1314                 Map.Entry<String, ForwardingRulesScopedList>>
1315             context,
1316         ApiFuture<ForwardingRuleAggregatedList> futureResponse) {
1317       ApiFuture<AggregatedListPage> futurePage =
1318           AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse);
1319       return ApiFutures.transform(
1320           futurePage,
1321           input -> new AggregatedListPagedResponse(input),
1322           MoreExecutors.directExecutor());
1323     }
1324 
AggregatedListPagedResponse(AggregatedListPage page)1325     private AggregatedListPagedResponse(AggregatedListPage page) {
1326       super(page, AggregatedListFixedSizeCollection.createEmptyCollection());
1327     }
1328   }
1329 
1330   public static class AggregatedListPage
1331       extends AbstractPage<
1332           AggregatedListForwardingRulesRequest,
1333           ForwardingRuleAggregatedList,
1334           Map.Entry<String, ForwardingRulesScopedList>,
1335           AggregatedListPage> {
1336 
AggregatedListPage( PageContext< AggregatedListForwardingRulesRequest, ForwardingRuleAggregatedList, Map.Entry<String, ForwardingRulesScopedList>> context, ForwardingRuleAggregatedList response)1337     private AggregatedListPage(
1338         PageContext<
1339                 AggregatedListForwardingRulesRequest,
1340                 ForwardingRuleAggregatedList,
1341                 Map.Entry<String, ForwardingRulesScopedList>>
1342             context,
1343         ForwardingRuleAggregatedList response) {
1344       super(context, response);
1345     }
1346 
createEmptyPage()1347     private static AggregatedListPage createEmptyPage() {
1348       return new AggregatedListPage(null, null);
1349     }
1350 
1351     @Override
createPage( PageContext< AggregatedListForwardingRulesRequest, ForwardingRuleAggregatedList, Map.Entry<String, ForwardingRulesScopedList>> context, ForwardingRuleAggregatedList response)1352     protected AggregatedListPage createPage(
1353         PageContext<
1354                 AggregatedListForwardingRulesRequest,
1355                 ForwardingRuleAggregatedList,
1356                 Map.Entry<String, ForwardingRulesScopedList>>
1357             context,
1358         ForwardingRuleAggregatedList response) {
1359       return new AggregatedListPage(context, response);
1360     }
1361 
1362     @Override
createPageAsync( PageContext< AggregatedListForwardingRulesRequest, ForwardingRuleAggregatedList, Map.Entry<String, ForwardingRulesScopedList>> context, ApiFuture<ForwardingRuleAggregatedList> futureResponse)1363     public ApiFuture<AggregatedListPage> createPageAsync(
1364         PageContext<
1365                 AggregatedListForwardingRulesRequest,
1366                 ForwardingRuleAggregatedList,
1367                 Map.Entry<String, ForwardingRulesScopedList>>
1368             context,
1369         ApiFuture<ForwardingRuleAggregatedList> futureResponse) {
1370       return super.createPageAsync(context, futureResponse);
1371     }
1372   }
1373 
1374   public static class AggregatedListFixedSizeCollection
1375       extends AbstractFixedSizeCollection<
1376           AggregatedListForwardingRulesRequest,
1377           ForwardingRuleAggregatedList,
1378           Map.Entry<String, ForwardingRulesScopedList>,
1379           AggregatedListPage,
1380           AggregatedListFixedSizeCollection> {
1381 
AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize)1382     private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) {
1383       super(pages, collectionSize);
1384     }
1385 
createEmptyCollection()1386     private static AggregatedListFixedSizeCollection createEmptyCollection() {
1387       return new AggregatedListFixedSizeCollection(null, 0);
1388     }
1389 
1390     @Override
createCollection( List<AggregatedListPage> pages, int collectionSize)1391     protected AggregatedListFixedSizeCollection createCollection(
1392         List<AggregatedListPage> pages, int collectionSize) {
1393       return new AggregatedListFixedSizeCollection(pages, collectionSize);
1394     }
1395   }
1396 
1397   public static class ListPagedResponse
1398       extends AbstractPagedListResponse<
1399           ListForwardingRulesRequest,
1400           ForwardingRuleList,
1401           ForwardingRule,
1402           ListPage,
1403           ListFixedSizeCollection> {
1404 
createAsync( PageContext<ListForwardingRulesRequest, ForwardingRuleList, ForwardingRule> context, ApiFuture<ForwardingRuleList> futureResponse)1405     public static ApiFuture<ListPagedResponse> createAsync(
1406         PageContext<ListForwardingRulesRequest, ForwardingRuleList, ForwardingRule> context,
1407         ApiFuture<ForwardingRuleList> futureResponse) {
1408       ApiFuture<ListPage> futurePage =
1409           ListPage.createEmptyPage().createPageAsync(context, futureResponse);
1410       return ApiFutures.transform(
1411           futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor());
1412     }
1413 
ListPagedResponse(ListPage page)1414     private ListPagedResponse(ListPage page) {
1415       super(page, ListFixedSizeCollection.createEmptyCollection());
1416     }
1417   }
1418 
1419   public static class ListPage
1420       extends AbstractPage<
1421           ListForwardingRulesRequest, ForwardingRuleList, ForwardingRule, ListPage> {
1422 
ListPage( PageContext<ListForwardingRulesRequest, ForwardingRuleList, ForwardingRule> context, ForwardingRuleList response)1423     private ListPage(
1424         PageContext<ListForwardingRulesRequest, ForwardingRuleList, ForwardingRule> context,
1425         ForwardingRuleList response) {
1426       super(context, response);
1427     }
1428 
createEmptyPage()1429     private static ListPage createEmptyPage() {
1430       return new ListPage(null, null);
1431     }
1432 
1433     @Override
createPage( PageContext<ListForwardingRulesRequest, ForwardingRuleList, ForwardingRule> context, ForwardingRuleList response)1434     protected ListPage createPage(
1435         PageContext<ListForwardingRulesRequest, ForwardingRuleList, ForwardingRule> context,
1436         ForwardingRuleList response) {
1437       return new ListPage(context, response);
1438     }
1439 
1440     @Override
createPageAsync( PageContext<ListForwardingRulesRequest, ForwardingRuleList, ForwardingRule> context, ApiFuture<ForwardingRuleList> futureResponse)1441     public ApiFuture<ListPage> createPageAsync(
1442         PageContext<ListForwardingRulesRequest, ForwardingRuleList, ForwardingRule> context,
1443         ApiFuture<ForwardingRuleList> futureResponse) {
1444       return super.createPageAsync(context, futureResponse);
1445     }
1446   }
1447 
1448   public static class ListFixedSizeCollection
1449       extends AbstractFixedSizeCollection<
1450           ListForwardingRulesRequest,
1451           ForwardingRuleList,
1452           ForwardingRule,
1453           ListPage,
1454           ListFixedSizeCollection> {
1455 
ListFixedSizeCollection(List<ListPage> pages, int collectionSize)1456     private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) {
1457       super(pages, collectionSize);
1458     }
1459 
createEmptyCollection()1460     private static ListFixedSizeCollection createEmptyCollection() {
1461       return new ListFixedSizeCollection(null, 0);
1462     }
1463 
1464     @Override
createCollection(List<ListPage> pages, int collectionSize)1465     protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) {
1466       return new ListFixedSizeCollection(pages, collectionSize);
1467     }
1468   }
1469 }
1470