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