• 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.BackendServicesStub;
31 import com.google.cloud.compute.v1.stub.BackendServicesStubSettings;
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 BackendServices 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 (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
53  *   String project = "project-309310695";
54  *   String backendService = "backendService-1884714623";
55  *   BackendService response = backendServicesClient.get(project, backendService);
56  * }
57  * }</pre>
58  *
59  * <p>Note: close() needs to be called on the BackendServicesClient object to clean up resources
60  * such as threads. In the example above, try-with-resources is used, which automatically calls
61  * 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 BackendServicesSettings to
84  * 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  * BackendServicesSettings backendServicesSettings =
95  *     BackendServicesSettings.newBuilder()
96  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
97  *         .build();
98  * BackendServicesClient backendServicesClient =
99  *     BackendServicesClient.create(backendServicesSettings);
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  * BackendServicesSettings backendServicesSettings =
111  *     BackendServicesSettings.newBuilder().setEndpoint(myEndpoint).build();
112  * BackendServicesClient backendServicesClient =
113  *     BackendServicesClient.create(backendServicesSettings);
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 BackendServicesClient implements BackgroundResource {
120   private final BackendServicesSettings settings;
121   private final BackendServicesStub stub;
122 
123   /** Constructs an instance of BackendServicesClient with default settings. */
create()124   public static final BackendServicesClient create() throws IOException {
125     return create(BackendServicesSettings.newBuilder().build());
126   }
127 
128   /**
129    * Constructs an instance of BackendServicesClient, using the given settings. The channels are
130    * created based on the settings passed in, or defaults for any settings that are not set.
131    */
create(BackendServicesSettings settings)132   public static final BackendServicesClient create(BackendServicesSettings settings)
133       throws IOException {
134     return new BackendServicesClient(settings);
135   }
136 
137   /**
138    * Constructs an instance of BackendServicesClient, using the given stub for making calls. This is
139    * for advanced usage - prefer using create(BackendServicesSettings).
140    */
create(BackendServicesStub stub)141   public static final BackendServicesClient create(BackendServicesStub stub) {
142     return new BackendServicesClient(stub);
143   }
144 
145   /**
146    * Constructs an instance of BackendServicesClient, using the given settings. This is protected so
147    * that it is easy to make a subclass, but otherwise, the static factory methods should be
148    * preferred.
149    */
BackendServicesClient(BackendServicesSettings settings)150   protected BackendServicesClient(BackendServicesSettings settings) throws IOException {
151     this.settings = settings;
152     this.stub = ((BackendServicesStubSettings) settings.getStubSettings()).createStub();
153   }
154 
BackendServicesClient(BackendServicesStub stub)155   protected BackendServicesClient(BackendServicesStub stub) {
156     this.settings = null;
157     this.stub = stub;
158   }
159 
getSettings()160   public final BackendServicesSettings getSettings() {
161     return settings;
162   }
163 
getStub()164   public BackendServicesStub getStub() {
165     return stub;
166   }
167 
168   // AUTO-GENERATED DOCUMENTATION AND METHOD.
169   /**
170    * Adds a key for validating requests with signed URLs for this backend service.
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 (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
181    *   String project = "project-309310695";
182    *   String backendService = "backendService-1884714623";
183    *   SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
184    *   Operation response =
185    *       backendServicesClient
186    *           .addSignedUrlKeyAsync(project, backendService, signedUrlKeyResource)
187    *           .get();
188    * }
189    * }</pre>
190    *
191    * @param project Project ID for this request.
192    * @param backendService Name of the BackendService resource to which the Signed URL Key should be
193    *     added. The name should conform to RFC1035.
194    * @param signedUrlKeyResource The body resource for this request
195    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
196    */
addSignedUrlKeyAsync( String project, String backendService, SignedUrlKey signedUrlKeyResource)197   public final OperationFuture<Operation, Operation> addSignedUrlKeyAsync(
198       String project, String backendService, SignedUrlKey signedUrlKeyResource) {
199     AddSignedUrlKeyBackendServiceRequest request =
200         AddSignedUrlKeyBackendServiceRequest.newBuilder()
201             .setProject(project)
202             .setBackendService(backendService)
203             .setSignedUrlKeyResource(signedUrlKeyResource)
204             .build();
205     return addSignedUrlKeyAsync(request);
206   }
207 
208   // AUTO-GENERATED DOCUMENTATION AND METHOD.
209   /**
210    * Adds a key for validating requests with signed URLs for this backend service.
211    *
212    * <p>Sample code:
213    *
214    * <pre>{@code
215    * // This snippet has been automatically generated and should be regarded as a code template only.
216    * // It will require modifications to work:
217    * // - It may require correct/in-range values for request initialization.
218    * // - It may require specifying regional endpoints when creating the service client as shown in
219    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
220    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
221    *   AddSignedUrlKeyBackendServiceRequest request =
222    *       AddSignedUrlKeyBackendServiceRequest.newBuilder()
223    *           .setBackendService("backendService-1884714623")
224    *           .setProject("project-309310695")
225    *           .setRequestId("requestId693933066")
226    *           .setSignedUrlKeyResource(SignedUrlKey.newBuilder().build())
227    *           .build();
228    *   Operation response = backendServicesClient.addSignedUrlKeyAsync(request).get();
229    * }
230    * }</pre>
231    *
232    * @param request The request object containing all of the parameters for the API call.
233    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
234    */
235   @BetaApi(
236       "The surface for long-running operations is not stable yet and may change in the future.")
addSignedUrlKeyAsync( AddSignedUrlKeyBackendServiceRequest request)237   public final OperationFuture<Operation, Operation> addSignedUrlKeyAsync(
238       AddSignedUrlKeyBackendServiceRequest request) {
239     return addSignedUrlKeyOperationCallable().futureCall(request);
240   }
241 
242   // AUTO-GENERATED DOCUMENTATION AND METHOD.
243   /**
244    * Adds a key for validating requests with signed URLs for this backend service.
245    *
246    * <p>Sample code:
247    *
248    * <pre>{@code
249    * // This snippet has been automatically generated and should be regarded as a code template only.
250    * // It will require modifications to work:
251    * // - It may require correct/in-range values for request initialization.
252    * // - It may require specifying regional endpoints when creating the service client as shown in
253    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
254    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
255    *   AddSignedUrlKeyBackendServiceRequest request =
256    *       AddSignedUrlKeyBackendServiceRequest.newBuilder()
257    *           .setBackendService("backendService-1884714623")
258    *           .setProject("project-309310695")
259    *           .setRequestId("requestId693933066")
260    *           .setSignedUrlKeyResource(SignedUrlKey.newBuilder().build())
261    *           .build();
262    *   OperationFuture<Operation, Operation> future =
263    *       backendServicesClient.addSignedUrlKeyOperationCallable().futureCall(request);
264    *   // Do something.
265    *   Operation response = future.get();
266    * }
267    * }</pre>
268    */
269   public final OperationCallable<AddSignedUrlKeyBackendServiceRequest, Operation, Operation>
addSignedUrlKeyOperationCallable()270       addSignedUrlKeyOperationCallable() {
271     return stub.addSignedUrlKeyOperationCallable();
272   }
273 
274   // AUTO-GENERATED DOCUMENTATION AND METHOD.
275   /**
276    * Adds a key for validating requests with signed URLs for this backend service.
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 (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
287    *   AddSignedUrlKeyBackendServiceRequest request =
288    *       AddSignedUrlKeyBackendServiceRequest.newBuilder()
289    *           .setBackendService("backendService-1884714623")
290    *           .setProject("project-309310695")
291    *           .setRequestId("requestId693933066")
292    *           .setSignedUrlKeyResource(SignedUrlKey.newBuilder().build())
293    *           .build();
294    *   ApiFuture<Operation> future =
295    *       backendServicesClient.addSignedUrlKeyCallable().futureCall(request);
296    *   // Do something.
297    *   Operation response = future.get();
298    * }
299    * }</pre>
300    */
301   public final UnaryCallable<AddSignedUrlKeyBackendServiceRequest, Operation>
addSignedUrlKeyCallable()302       addSignedUrlKeyCallable() {
303     return stub.addSignedUrlKeyCallable();
304   }
305 
306   // AUTO-GENERATED DOCUMENTATION AND METHOD.
307   /**
308    * Retrieves the list of all BackendService resources, regional and global, available to the
309    * specified project.
310    *
311    * <p>Sample code:
312    *
313    * <pre>{@code
314    * // This snippet has been automatically generated and should be regarded as a code template only.
315    * // It will require modifications to work:
316    * // - It may require correct/in-range values for request initialization.
317    * // - It may require specifying regional endpoints when creating the service client as shown in
318    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
319    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
320    *   String project = "project-309310695";
321    *   for (Map.Entry<String, BackendServicesScopedList> element :
322    *       backendServicesClient.aggregatedList(project).iterateAll()) {
323    *     // doThingsWith(element);
324    *   }
325    * }
326    * }</pre>
327    *
328    * @param project Name of the project scoping this request.
329    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
330    */
aggregatedList(String project)331   public final AggregatedListPagedResponse aggregatedList(String project) {
332     AggregatedListBackendServicesRequest request =
333         AggregatedListBackendServicesRequest.newBuilder().setProject(project).build();
334     return aggregatedList(request);
335   }
336 
337   // AUTO-GENERATED DOCUMENTATION AND METHOD.
338   /**
339    * Retrieves the list of all BackendService resources, regional and global, available to the
340    * specified project.
341    *
342    * <p>Sample code:
343    *
344    * <pre>{@code
345    * // This snippet has been automatically generated and should be regarded as a code template only.
346    * // It will require modifications to work:
347    * // - It may require correct/in-range values for request initialization.
348    * // - It may require specifying regional endpoints when creating the service client as shown in
349    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
350    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
351    *   AggregatedListBackendServicesRequest request =
352    *       AggregatedListBackendServicesRequest.newBuilder()
353    *           .setFilter("filter-1274492040")
354    *           .setIncludeAllScopes(true)
355    *           .setMaxResults(1128457243)
356    *           .setOrderBy("orderBy-1207110587")
357    *           .setPageToken("pageToken873572522")
358    *           .setProject("project-309310695")
359    *           .setReturnPartialSuccess(true)
360    *           .build();
361    *   for (Map.Entry<String, BackendServicesScopedList> element :
362    *       backendServicesClient.aggregatedList(request).iterateAll()) {
363    *     // doThingsWith(element);
364    *   }
365    * }
366    * }</pre>
367    *
368    * @param request The request object containing all of the parameters for the API call.
369    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
370    */
aggregatedList( AggregatedListBackendServicesRequest request)371   public final AggregatedListPagedResponse aggregatedList(
372       AggregatedListBackendServicesRequest request) {
373     return aggregatedListPagedCallable().call(request);
374   }
375 
376   // AUTO-GENERATED DOCUMENTATION AND METHOD.
377   /**
378    * Retrieves the list of all BackendService resources, regional and global, available to the
379    * specified project.
380    *
381    * <p>Sample code:
382    *
383    * <pre>{@code
384    * // This snippet has been automatically generated and should be regarded as a code template only.
385    * // It will require modifications to work:
386    * // - It may require correct/in-range values for request initialization.
387    * // - It may require specifying regional endpoints when creating the service client as shown in
388    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
389    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
390    *   AggregatedListBackendServicesRequest request =
391    *       AggregatedListBackendServicesRequest.newBuilder()
392    *           .setFilter("filter-1274492040")
393    *           .setIncludeAllScopes(true)
394    *           .setMaxResults(1128457243)
395    *           .setOrderBy("orderBy-1207110587")
396    *           .setPageToken("pageToken873572522")
397    *           .setProject("project-309310695")
398    *           .setReturnPartialSuccess(true)
399    *           .build();
400    *   ApiFuture<Map.Entry<String, BackendServicesScopedList>> future =
401    *       backendServicesClient.aggregatedListPagedCallable().futureCall(request);
402    *   // Do something.
403    *   for (Map.Entry<String, BackendServicesScopedList> element : future.get().iterateAll()) {
404    *     // doThingsWith(element);
405    *   }
406    * }
407    * }</pre>
408    */
409   public final UnaryCallable<AggregatedListBackendServicesRequest, AggregatedListPagedResponse>
aggregatedListPagedCallable()410       aggregatedListPagedCallable() {
411     return stub.aggregatedListPagedCallable();
412   }
413 
414   // AUTO-GENERATED DOCUMENTATION AND METHOD.
415   /**
416    * Retrieves the list of all BackendService resources, regional and global, available to the
417    * specified project.
418    *
419    * <p>Sample code:
420    *
421    * <pre>{@code
422    * // This snippet has been automatically generated and should be regarded as a code template only.
423    * // It will require modifications to work:
424    * // - It may require correct/in-range values for request initialization.
425    * // - It may require specifying regional endpoints when creating the service client as shown in
426    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
427    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
428    *   AggregatedListBackendServicesRequest request =
429    *       AggregatedListBackendServicesRequest.newBuilder()
430    *           .setFilter("filter-1274492040")
431    *           .setIncludeAllScopes(true)
432    *           .setMaxResults(1128457243)
433    *           .setOrderBy("orderBy-1207110587")
434    *           .setPageToken("pageToken873572522")
435    *           .setProject("project-309310695")
436    *           .setReturnPartialSuccess(true)
437    *           .build();
438    *   while (true) {
439    *     BackendServiceAggregatedList response =
440    *         backendServicesClient.aggregatedListCallable().call(request);
441    *     for (Map.Entry<String, BackendServicesScopedList> element : response.getItemsList()) {
442    *       // doThingsWith(element);
443    *     }
444    *     String nextPageToken = response.getNextPageToken();
445    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
446    *       request = request.toBuilder().setPageToken(nextPageToken).build();
447    *     } else {
448    *       break;
449    *     }
450    *   }
451    * }
452    * }</pre>
453    */
454   public final UnaryCallable<AggregatedListBackendServicesRequest, BackendServiceAggregatedList>
aggregatedListCallable()455       aggregatedListCallable() {
456     return stub.aggregatedListCallable();
457   }
458 
459   // AUTO-GENERATED DOCUMENTATION AND METHOD.
460   /**
461    * Deletes the specified BackendService resource.
462    *
463    * <p>Sample code:
464    *
465    * <pre>{@code
466    * // This snippet has been automatically generated and should be regarded as a code template only.
467    * // It will require modifications to work:
468    * // - It may require correct/in-range values for request initialization.
469    * // - It may require specifying regional endpoints when creating the service client as shown in
470    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
471    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
472    *   String project = "project-309310695";
473    *   String backendService = "backendService-1884714623";
474    *   Operation response = backendServicesClient.deleteAsync(project, backendService).get();
475    * }
476    * }</pre>
477    *
478    * @param project Project ID for this request.
479    * @param backendService Name of the BackendService resource to delete.
480    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
481    */
deleteAsync( String project, String backendService)482   public final OperationFuture<Operation, Operation> deleteAsync(
483       String project, String backendService) {
484     DeleteBackendServiceRequest request =
485         DeleteBackendServiceRequest.newBuilder()
486             .setProject(project)
487             .setBackendService(backendService)
488             .build();
489     return deleteAsync(request);
490   }
491 
492   // AUTO-GENERATED DOCUMENTATION AND METHOD.
493   /**
494    * Deletes the specified BackendService resource.
495    *
496    * <p>Sample code:
497    *
498    * <pre>{@code
499    * // This snippet has been automatically generated and should be regarded as a code template only.
500    * // It will require modifications to work:
501    * // - It may require correct/in-range values for request initialization.
502    * // - It may require specifying regional endpoints when creating the service client as shown in
503    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
504    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
505    *   DeleteBackendServiceRequest request =
506    *       DeleteBackendServiceRequest.newBuilder()
507    *           .setBackendService("backendService-1884714623")
508    *           .setProject("project-309310695")
509    *           .setRequestId("requestId693933066")
510    *           .build();
511    *   Operation response = backendServicesClient.deleteAsync(request).get();
512    * }
513    * }</pre>
514    *
515    * @param request The request object containing all of the parameters for the API call.
516    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
517    */
518   @BetaApi(
519       "The surface for long-running operations is not stable yet and may change in the future.")
deleteAsync( DeleteBackendServiceRequest request)520   public final OperationFuture<Operation, Operation> deleteAsync(
521       DeleteBackendServiceRequest request) {
522     return deleteOperationCallable().futureCall(request);
523   }
524 
525   // AUTO-GENERATED DOCUMENTATION AND METHOD.
526   /**
527    * Deletes the specified BackendService resource.
528    *
529    * <p>Sample code:
530    *
531    * <pre>{@code
532    * // This snippet has been automatically generated and should be regarded as a code template only.
533    * // It will require modifications to work:
534    * // - It may require correct/in-range values for request initialization.
535    * // - It may require specifying regional endpoints when creating the service client as shown in
536    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
537    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
538    *   DeleteBackendServiceRequest request =
539    *       DeleteBackendServiceRequest.newBuilder()
540    *           .setBackendService("backendService-1884714623")
541    *           .setProject("project-309310695")
542    *           .setRequestId("requestId693933066")
543    *           .build();
544    *   OperationFuture<Operation, Operation> future =
545    *       backendServicesClient.deleteOperationCallable().futureCall(request);
546    *   // Do something.
547    *   Operation response = future.get();
548    * }
549    * }</pre>
550    */
551   public final OperationCallable<DeleteBackendServiceRequest, Operation, Operation>
deleteOperationCallable()552       deleteOperationCallable() {
553     return stub.deleteOperationCallable();
554   }
555 
556   // AUTO-GENERATED DOCUMENTATION AND METHOD.
557   /**
558    * Deletes the specified BackendService resource.
559    *
560    * <p>Sample code:
561    *
562    * <pre>{@code
563    * // This snippet has been automatically generated and should be regarded as a code template only.
564    * // It will require modifications to work:
565    * // - It may require correct/in-range values for request initialization.
566    * // - It may require specifying regional endpoints when creating the service client as shown in
567    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
568    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
569    *   DeleteBackendServiceRequest request =
570    *       DeleteBackendServiceRequest.newBuilder()
571    *           .setBackendService("backendService-1884714623")
572    *           .setProject("project-309310695")
573    *           .setRequestId("requestId693933066")
574    *           .build();
575    *   ApiFuture<Operation> future = backendServicesClient.deleteCallable().futureCall(request);
576    *   // Do something.
577    *   Operation response = future.get();
578    * }
579    * }</pre>
580    */
deleteCallable()581   public final UnaryCallable<DeleteBackendServiceRequest, Operation> deleteCallable() {
582     return stub.deleteCallable();
583   }
584 
585   // AUTO-GENERATED DOCUMENTATION AND METHOD.
586   /**
587    * Deletes a key for validating requests with signed URLs for this backend service.
588    *
589    * <p>Sample code:
590    *
591    * <pre>{@code
592    * // This snippet has been automatically generated and should be regarded as a code template only.
593    * // It will require modifications to work:
594    * // - It may require correct/in-range values for request initialization.
595    * // - It may require specifying regional endpoints when creating the service client as shown in
596    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
597    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
598    *   String project = "project-309310695";
599    *   String backendService = "backendService-1884714623";
600    *   String keyName = "keyName-815643254";
601    *   Operation response =
602    *       backendServicesClient.deleteSignedUrlKeyAsync(project, backendService, keyName).get();
603    * }
604    * }</pre>
605    *
606    * @param project Project ID for this request.
607    * @param backendService Name of the BackendService resource to which the Signed URL Key should be
608    *     added. The name should conform to RFC1035.
609    * @param keyName The name of the Signed URL Key to delete.
610    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
611    */
deleteSignedUrlKeyAsync( String project, String backendService, String keyName)612   public final OperationFuture<Operation, Operation> deleteSignedUrlKeyAsync(
613       String project, String backendService, String keyName) {
614     DeleteSignedUrlKeyBackendServiceRequest request =
615         DeleteSignedUrlKeyBackendServiceRequest.newBuilder()
616             .setProject(project)
617             .setBackendService(backendService)
618             .setKeyName(keyName)
619             .build();
620     return deleteSignedUrlKeyAsync(request);
621   }
622 
623   // AUTO-GENERATED DOCUMENTATION AND METHOD.
624   /**
625    * Deletes a key for validating requests with signed URLs for this backend service.
626    *
627    * <p>Sample code:
628    *
629    * <pre>{@code
630    * // This snippet has been automatically generated and should be regarded as a code template only.
631    * // It will require modifications to work:
632    * // - It may require correct/in-range values for request initialization.
633    * // - It may require specifying regional endpoints when creating the service client as shown in
634    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
635    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
636    *   DeleteSignedUrlKeyBackendServiceRequest request =
637    *       DeleteSignedUrlKeyBackendServiceRequest.newBuilder()
638    *           .setBackendService("backendService-1884714623")
639    *           .setKeyName("keyName-815643254")
640    *           .setProject("project-309310695")
641    *           .setRequestId("requestId693933066")
642    *           .build();
643    *   Operation response = backendServicesClient.deleteSignedUrlKeyAsync(request).get();
644    * }
645    * }</pre>
646    *
647    * @param request The request object containing all of the parameters for the API call.
648    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
649    */
650   @BetaApi(
651       "The surface for long-running operations is not stable yet and may change in the future.")
deleteSignedUrlKeyAsync( DeleteSignedUrlKeyBackendServiceRequest request)652   public final OperationFuture<Operation, Operation> deleteSignedUrlKeyAsync(
653       DeleteSignedUrlKeyBackendServiceRequest request) {
654     return deleteSignedUrlKeyOperationCallable().futureCall(request);
655   }
656 
657   // AUTO-GENERATED DOCUMENTATION AND METHOD.
658   /**
659    * Deletes a key for validating requests with signed URLs for this backend service.
660    *
661    * <p>Sample code:
662    *
663    * <pre>{@code
664    * // This snippet has been automatically generated and should be regarded as a code template only.
665    * // It will require modifications to work:
666    * // - It may require correct/in-range values for request initialization.
667    * // - It may require specifying regional endpoints when creating the service client as shown in
668    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
669    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
670    *   DeleteSignedUrlKeyBackendServiceRequest request =
671    *       DeleteSignedUrlKeyBackendServiceRequest.newBuilder()
672    *           .setBackendService("backendService-1884714623")
673    *           .setKeyName("keyName-815643254")
674    *           .setProject("project-309310695")
675    *           .setRequestId("requestId693933066")
676    *           .build();
677    *   OperationFuture<Operation, Operation> future =
678    *       backendServicesClient.deleteSignedUrlKeyOperationCallable().futureCall(request);
679    *   // Do something.
680    *   Operation response = future.get();
681    * }
682    * }</pre>
683    */
684   public final OperationCallable<DeleteSignedUrlKeyBackendServiceRequest, Operation, Operation>
deleteSignedUrlKeyOperationCallable()685       deleteSignedUrlKeyOperationCallable() {
686     return stub.deleteSignedUrlKeyOperationCallable();
687   }
688 
689   // AUTO-GENERATED DOCUMENTATION AND METHOD.
690   /**
691    * Deletes a key for validating requests with signed URLs for this backend service.
692    *
693    * <p>Sample code:
694    *
695    * <pre>{@code
696    * // This snippet has been automatically generated and should be regarded as a code template only.
697    * // It will require modifications to work:
698    * // - It may require correct/in-range values for request initialization.
699    * // - It may require specifying regional endpoints when creating the service client as shown in
700    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
701    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
702    *   DeleteSignedUrlKeyBackendServiceRequest request =
703    *       DeleteSignedUrlKeyBackendServiceRequest.newBuilder()
704    *           .setBackendService("backendService-1884714623")
705    *           .setKeyName("keyName-815643254")
706    *           .setProject("project-309310695")
707    *           .setRequestId("requestId693933066")
708    *           .build();
709    *   ApiFuture<Operation> future =
710    *       backendServicesClient.deleteSignedUrlKeyCallable().futureCall(request);
711    *   // Do something.
712    *   Operation response = future.get();
713    * }
714    * }</pre>
715    */
716   public final UnaryCallable<DeleteSignedUrlKeyBackendServiceRequest, Operation>
deleteSignedUrlKeyCallable()717       deleteSignedUrlKeyCallable() {
718     return stub.deleteSignedUrlKeyCallable();
719   }
720 
721   // AUTO-GENERATED DOCUMENTATION AND METHOD.
722   /**
723    * Returns the specified BackendService resource.
724    *
725    * <p>Sample code:
726    *
727    * <pre>{@code
728    * // This snippet has been automatically generated and should be regarded as a code template only.
729    * // It will require modifications to work:
730    * // - It may require correct/in-range values for request initialization.
731    * // - It may require specifying regional endpoints when creating the service client as shown in
732    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
733    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
734    *   String project = "project-309310695";
735    *   String backendService = "backendService-1884714623";
736    *   BackendService response = backendServicesClient.get(project, backendService);
737    * }
738    * }</pre>
739    *
740    * @param project Project ID for this request.
741    * @param backendService Name of the BackendService resource to return.
742    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
743    */
get(String project, String backendService)744   public final BackendService get(String project, String backendService) {
745     GetBackendServiceRequest request =
746         GetBackendServiceRequest.newBuilder()
747             .setProject(project)
748             .setBackendService(backendService)
749             .build();
750     return get(request);
751   }
752 
753   // AUTO-GENERATED DOCUMENTATION AND METHOD.
754   /**
755    * Returns the specified BackendService resource.
756    *
757    * <p>Sample code:
758    *
759    * <pre>{@code
760    * // This snippet has been automatically generated and should be regarded as a code template only.
761    * // It will require modifications to work:
762    * // - It may require correct/in-range values for request initialization.
763    * // - It may require specifying regional endpoints when creating the service client as shown in
764    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
765    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
766    *   GetBackendServiceRequest request =
767    *       GetBackendServiceRequest.newBuilder()
768    *           .setBackendService("backendService-1884714623")
769    *           .setProject("project-309310695")
770    *           .build();
771    *   BackendService response = backendServicesClient.get(request);
772    * }
773    * }</pre>
774    *
775    * @param request The request object containing all of the parameters for the API call.
776    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
777    */
get(GetBackendServiceRequest request)778   public final BackendService get(GetBackendServiceRequest request) {
779     return getCallable().call(request);
780   }
781 
782   // AUTO-GENERATED DOCUMENTATION AND METHOD.
783   /**
784    * Returns the specified BackendService resource.
785    *
786    * <p>Sample code:
787    *
788    * <pre>{@code
789    * // This snippet has been automatically generated and should be regarded as a code template only.
790    * // It will require modifications to work:
791    * // - It may require correct/in-range values for request initialization.
792    * // - It may require specifying regional endpoints when creating the service client as shown in
793    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
794    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
795    *   GetBackendServiceRequest request =
796    *       GetBackendServiceRequest.newBuilder()
797    *           .setBackendService("backendService-1884714623")
798    *           .setProject("project-309310695")
799    *           .build();
800    *   ApiFuture<BackendService> future = backendServicesClient.getCallable().futureCall(request);
801    *   // Do something.
802    *   BackendService response = future.get();
803    * }
804    * }</pre>
805    */
getCallable()806   public final UnaryCallable<GetBackendServiceRequest, BackendService> getCallable() {
807     return stub.getCallable();
808   }
809 
810   // AUTO-GENERATED DOCUMENTATION AND METHOD.
811   /**
812    * Gets the most recent health check results for this BackendService. Example request body: {
813    * "group": "/zones/us-east1-b/instanceGroups/lb-backend-example" }
814    *
815    * <p>Sample code:
816    *
817    * <pre>{@code
818    * // This snippet has been automatically generated and should be regarded as a code template only.
819    * // It will require modifications to work:
820    * // - It may require correct/in-range values for request initialization.
821    * // - It may require specifying regional endpoints when creating the service client as shown in
822    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
823    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
824    *   String project = "project-309310695";
825    *   String backendService = "backendService-1884714623";
826    *   ResourceGroupReference resourceGroupReferenceResource =
827    *       ResourceGroupReference.newBuilder().build();
828    *   BackendServiceGroupHealth response =
829    *       backendServicesClient.getHealth(project, backendService, resourceGroupReferenceResource);
830    * }
831    * }</pre>
832    *
833    * @param project
834    * @param backendService Name of the BackendService resource to which the queried instance
835    *     belongs.
836    * @param resourceGroupReferenceResource The body resource for this request
837    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
838    */
getHealth( String project, String backendService, ResourceGroupReference resourceGroupReferenceResource)839   public final BackendServiceGroupHealth getHealth(
840       String project,
841       String backendService,
842       ResourceGroupReference resourceGroupReferenceResource) {
843     GetHealthBackendServiceRequest request =
844         GetHealthBackendServiceRequest.newBuilder()
845             .setProject(project)
846             .setBackendService(backendService)
847             .setResourceGroupReferenceResource(resourceGroupReferenceResource)
848             .build();
849     return getHealth(request);
850   }
851 
852   // AUTO-GENERATED DOCUMENTATION AND METHOD.
853   /**
854    * Gets the most recent health check results for this BackendService. Example request body: {
855    * "group": "/zones/us-east1-b/instanceGroups/lb-backend-example" }
856    *
857    * <p>Sample code:
858    *
859    * <pre>{@code
860    * // This snippet has been automatically generated and should be regarded as a code template only.
861    * // It will require modifications to work:
862    * // - It may require correct/in-range values for request initialization.
863    * // - It may require specifying regional endpoints when creating the service client as shown in
864    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
865    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
866    *   GetHealthBackendServiceRequest request =
867    *       GetHealthBackendServiceRequest.newBuilder()
868    *           .setBackendService("backendService-1884714623")
869    *           .setProject("project-309310695")
870    *           .setResourceGroupReferenceResource(ResourceGroupReference.newBuilder().build())
871    *           .build();
872    *   BackendServiceGroupHealth response = backendServicesClient.getHealth(request);
873    * }
874    * }</pre>
875    *
876    * @param request The request object containing all of the parameters for the API call.
877    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
878    */
getHealth(GetHealthBackendServiceRequest request)879   public final BackendServiceGroupHealth getHealth(GetHealthBackendServiceRequest request) {
880     return getHealthCallable().call(request);
881   }
882 
883   // AUTO-GENERATED DOCUMENTATION AND METHOD.
884   /**
885    * Gets the most recent health check results for this BackendService. Example request body: {
886    * "group": "/zones/us-east1-b/instanceGroups/lb-backend-example" }
887    *
888    * <p>Sample code:
889    *
890    * <pre>{@code
891    * // This snippet has been automatically generated and should be regarded as a code template only.
892    * // It will require modifications to work:
893    * // - It may require correct/in-range values for request initialization.
894    * // - It may require specifying regional endpoints when creating the service client as shown in
895    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
896    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
897    *   GetHealthBackendServiceRequest request =
898    *       GetHealthBackendServiceRequest.newBuilder()
899    *           .setBackendService("backendService-1884714623")
900    *           .setProject("project-309310695")
901    *           .setResourceGroupReferenceResource(ResourceGroupReference.newBuilder().build())
902    *           .build();
903    *   ApiFuture<BackendServiceGroupHealth> future =
904    *       backendServicesClient.getHealthCallable().futureCall(request);
905    *   // Do something.
906    *   BackendServiceGroupHealth response = future.get();
907    * }
908    * }</pre>
909    */
910   public final UnaryCallable<GetHealthBackendServiceRequest, BackendServiceGroupHealth>
getHealthCallable()911       getHealthCallable() {
912     return stub.getHealthCallable();
913   }
914 
915   // AUTO-GENERATED DOCUMENTATION AND METHOD.
916   /**
917    * Gets the access control policy for a resource. May be empty if no such policy or resource
918    * exists.
919    *
920    * <p>Sample code:
921    *
922    * <pre>{@code
923    * // This snippet has been automatically generated and should be regarded as a code template only.
924    * // It will require modifications to work:
925    * // - It may require correct/in-range values for request initialization.
926    * // - It may require specifying regional endpoints when creating the service client as shown in
927    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
928    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
929    *   String project = "project-309310695";
930    *   String resource = "resource-341064690";
931    *   Policy response = backendServicesClient.getIamPolicy(project, resource);
932    * }
933    * }</pre>
934    *
935    * @param project Project ID for this request.
936    * @param resource Name or id of the resource for this request.
937    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
938    */
getIamPolicy(String project, String resource)939   public final Policy getIamPolicy(String project, String resource) {
940     GetIamPolicyBackendServiceRequest request =
941         GetIamPolicyBackendServiceRequest.newBuilder()
942             .setProject(project)
943             .setResource(resource)
944             .build();
945     return getIamPolicy(request);
946   }
947 
948   // AUTO-GENERATED DOCUMENTATION AND METHOD.
949   /**
950    * Gets the access control policy for a resource. May be empty if no such policy or resource
951    * exists.
952    *
953    * <p>Sample code:
954    *
955    * <pre>{@code
956    * // This snippet has been automatically generated and should be regarded as a code template only.
957    * // It will require modifications to work:
958    * // - It may require correct/in-range values for request initialization.
959    * // - It may require specifying regional endpoints when creating the service client as shown in
960    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
961    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
962    *   GetIamPolicyBackendServiceRequest request =
963    *       GetIamPolicyBackendServiceRequest.newBuilder()
964    *           .setOptionsRequestedPolicyVersion(-574521795)
965    *           .setProject("project-309310695")
966    *           .setResource("resource-341064690")
967    *           .build();
968    *   Policy response = backendServicesClient.getIamPolicy(request);
969    * }
970    * }</pre>
971    *
972    * @param request The request object containing all of the parameters for the API call.
973    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
974    */
getIamPolicy(GetIamPolicyBackendServiceRequest request)975   public final Policy getIamPolicy(GetIamPolicyBackendServiceRequest request) {
976     return getIamPolicyCallable().call(request);
977   }
978 
979   // AUTO-GENERATED DOCUMENTATION AND METHOD.
980   /**
981    * Gets the access control policy for a resource. May be empty if no such policy or resource
982    * exists.
983    *
984    * <p>Sample code:
985    *
986    * <pre>{@code
987    * // This snippet has been automatically generated and should be regarded as a code template only.
988    * // It will require modifications to work:
989    * // - It may require correct/in-range values for request initialization.
990    * // - It may require specifying regional endpoints when creating the service client as shown in
991    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
992    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
993    *   GetIamPolicyBackendServiceRequest request =
994    *       GetIamPolicyBackendServiceRequest.newBuilder()
995    *           .setOptionsRequestedPolicyVersion(-574521795)
996    *           .setProject("project-309310695")
997    *           .setResource("resource-341064690")
998    *           .build();
999    *   ApiFuture<Policy> future = backendServicesClient.getIamPolicyCallable().futureCall(request);
1000    *   // Do something.
1001    *   Policy response = future.get();
1002    * }
1003    * }</pre>
1004    */
getIamPolicyCallable()1005   public final UnaryCallable<GetIamPolicyBackendServiceRequest, Policy> getIamPolicyCallable() {
1006     return stub.getIamPolicyCallable();
1007   }
1008 
1009   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1010   /**
1011    * Creates a BackendService resource in the specified project using the data included in the
1012    * request. For more information, see Backend services overview .
1013    *
1014    * <p>Sample code:
1015    *
1016    * <pre>{@code
1017    * // This snippet has been automatically generated and should be regarded as a code template only.
1018    * // It will require modifications to work:
1019    * // - It may require correct/in-range values for request initialization.
1020    * // - It may require specifying regional endpoints when creating the service client as shown in
1021    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1022    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1023    *   String project = "project-309310695";
1024    *   BackendService backendServiceResource = BackendService.newBuilder().build();
1025    *   Operation response = backendServicesClient.insertAsync(project, backendServiceResource).get();
1026    * }
1027    * }</pre>
1028    *
1029    * @param project Project ID for this request.
1030    * @param backendServiceResource The body resource for this request
1031    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1032    */
insertAsync( String project, BackendService backendServiceResource)1033   public final OperationFuture<Operation, Operation> insertAsync(
1034       String project, BackendService backendServiceResource) {
1035     InsertBackendServiceRequest request =
1036         InsertBackendServiceRequest.newBuilder()
1037             .setProject(project)
1038             .setBackendServiceResource(backendServiceResource)
1039             .build();
1040     return insertAsync(request);
1041   }
1042 
1043   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1044   /**
1045    * Creates a BackendService resource in the specified project using the data included in the
1046    * request. For more information, see Backend services overview .
1047    *
1048    * <p>Sample code:
1049    *
1050    * <pre>{@code
1051    * // This snippet has been automatically generated and should be regarded as a code template only.
1052    * // It will require modifications to work:
1053    * // - It may require correct/in-range values for request initialization.
1054    * // - It may require specifying regional endpoints when creating the service client as shown in
1055    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1056    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1057    *   InsertBackendServiceRequest request =
1058    *       InsertBackendServiceRequest.newBuilder()
1059    *           .setBackendServiceResource(BackendService.newBuilder().build())
1060    *           .setProject("project-309310695")
1061    *           .setRequestId("requestId693933066")
1062    *           .build();
1063    *   Operation response = backendServicesClient.insertAsync(request).get();
1064    * }
1065    * }</pre>
1066    *
1067    * @param request The request object containing all of the parameters for the API call.
1068    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1069    */
1070   @BetaApi(
1071       "The surface for long-running operations is not stable yet and may change in the future.")
insertAsync( InsertBackendServiceRequest request)1072   public final OperationFuture<Operation, Operation> insertAsync(
1073       InsertBackendServiceRequest request) {
1074     return insertOperationCallable().futureCall(request);
1075   }
1076 
1077   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1078   /**
1079    * Creates a BackendService resource in the specified project using the data included in the
1080    * request. For more information, see Backend services overview .
1081    *
1082    * <p>Sample code:
1083    *
1084    * <pre>{@code
1085    * // This snippet has been automatically generated and should be regarded as a code template only.
1086    * // It will require modifications to work:
1087    * // - It may require correct/in-range values for request initialization.
1088    * // - It may require specifying regional endpoints when creating the service client as shown in
1089    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1090    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1091    *   InsertBackendServiceRequest request =
1092    *       InsertBackendServiceRequest.newBuilder()
1093    *           .setBackendServiceResource(BackendService.newBuilder().build())
1094    *           .setProject("project-309310695")
1095    *           .setRequestId("requestId693933066")
1096    *           .build();
1097    *   OperationFuture<Operation, Operation> future =
1098    *       backendServicesClient.insertOperationCallable().futureCall(request);
1099    *   // Do something.
1100    *   Operation response = future.get();
1101    * }
1102    * }</pre>
1103    */
1104   public final OperationCallable<InsertBackendServiceRequest, Operation, Operation>
insertOperationCallable()1105       insertOperationCallable() {
1106     return stub.insertOperationCallable();
1107   }
1108 
1109   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1110   /**
1111    * Creates a BackendService resource in the specified project using the data included in the
1112    * request. For more information, see Backend services overview .
1113    *
1114    * <p>Sample code:
1115    *
1116    * <pre>{@code
1117    * // This snippet has been automatically generated and should be regarded as a code template only.
1118    * // It will require modifications to work:
1119    * // - It may require correct/in-range values for request initialization.
1120    * // - It may require specifying regional endpoints when creating the service client as shown in
1121    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1122    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1123    *   InsertBackendServiceRequest request =
1124    *       InsertBackendServiceRequest.newBuilder()
1125    *           .setBackendServiceResource(BackendService.newBuilder().build())
1126    *           .setProject("project-309310695")
1127    *           .setRequestId("requestId693933066")
1128    *           .build();
1129    *   ApiFuture<Operation> future = backendServicesClient.insertCallable().futureCall(request);
1130    *   // Do something.
1131    *   Operation response = future.get();
1132    * }
1133    * }</pre>
1134    */
insertCallable()1135   public final UnaryCallable<InsertBackendServiceRequest, Operation> insertCallable() {
1136     return stub.insertCallable();
1137   }
1138 
1139   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1140   /**
1141    * Retrieves the list of BackendService resources available to the specified project.
1142    *
1143    * <p>Sample code:
1144    *
1145    * <pre>{@code
1146    * // This snippet has been automatically generated and should be regarded as a code template only.
1147    * // It will require modifications to work:
1148    * // - It may require correct/in-range values for request initialization.
1149    * // - It may require specifying regional endpoints when creating the service client as shown in
1150    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1151    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1152    *   String project = "project-309310695";
1153    *   for (BackendService element : backendServicesClient.list(project).iterateAll()) {
1154    *     // doThingsWith(element);
1155    *   }
1156    * }
1157    * }</pre>
1158    *
1159    * @param project Project ID for this request.
1160    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1161    */
list(String project)1162   public final ListPagedResponse list(String project) {
1163     ListBackendServicesRequest request =
1164         ListBackendServicesRequest.newBuilder().setProject(project).build();
1165     return list(request);
1166   }
1167 
1168   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1169   /**
1170    * Retrieves the list of BackendService resources available to the specified project.
1171    *
1172    * <p>Sample code:
1173    *
1174    * <pre>{@code
1175    * // This snippet has been automatically generated and should be regarded as a code template only.
1176    * // It will require modifications to work:
1177    * // - It may require correct/in-range values for request initialization.
1178    * // - It may require specifying regional endpoints when creating the service client as shown in
1179    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1180    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1181    *   ListBackendServicesRequest request =
1182    *       ListBackendServicesRequest.newBuilder()
1183    *           .setFilter("filter-1274492040")
1184    *           .setMaxResults(1128457243)
1185    *           .setOrderBy("orderBy-1207110587")
1186    *           .setPageToken("pageToken873572522")
1187    *           .setProject("project-309310695")
1188    *           .setReturnPartialSuccess(true)
1189    *           .build();
1190    *   for (BackendService element : backendServicesClient.list(request).iterateAll()) {
1191    *     // doThingsWith(element);
1192    *   }
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    */
list(ListBackendServicesRequest request)1199   public final ListPagedResponse list(ListBackendServicesRequest request) {
1200     return listPagedCallable().call(request);
1201   }
1202 
1203   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1204   /**
1205    * Retrieves the list of BackendService resources available to the specified project.
1206    *
1207    * <p>Sample code:
1208    *
1209    * <pre>{@code
1210    * // This snippet has been automatically generated and should be regarded as a code template only.
1211    * // It will require modifications to work:
1212    * // - It may require correct/in-range values for request initialization.
1213    * // - It may require specifying regional endpoints when creating the service client as shown in
1214    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1215    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1216    *   ListBackendServicesRequest request =
1217    *       ListBackendServicesRequest.newBuilder()
1218    *           .setFilter("filter-1274492040")
1219    *           .setMaxResults(1128457243)
1220    *           .setOrderBy("orderBy-1207110587")
1221    *           .setPageToken("pageToken873572522")
1222    *           .setProject("project-309310695")
1223    *           .setReturnPartialSuccess(true)
1224    *           .build();
1225    *   ApiFuture<BackendService> future =
1226    *       backendServicesClient.listPagedCallable().futureCall(request);
1227    *   // Do something.
1228    *   for (BackendService element : future.get().iterateAll()) {
1229    *     // doThingsWith(element);
1230    *   }
1231    * }
1232    * }</pre>
1233    */
listPagedCallable()1234   public final UnaryCallable<ListBackendServicesRequest, ListPagedResponse> listPagedCallable() {
1235     return stub.listPagedCallable();
1236   }
1237 
1238   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1239   /**
1240    * Retrieves the list of BackendService resources available to the specified project.
1241    *
1242    * <p>Sample code:
1243    *
1244    * <pre>{@code
1245    * // This snippet has been automatically generated and should be regarded as a code template only.
1246    * // It will require modifications to work:
1247    * // - It may require correct/in-range values for request initialization.
1248    * // - It may require specifying regional endpoints when creating the service client as shown in
1249    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1250    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1251    *   ListBackendServicesRequest request =
1252    *       ListBackendServicesRequest.newBuilder()
1253    *           .setFilter("filter-1274492040")
1254    *           .setMaxResults(1128457243)
1255    *           .setOrderBy("orderBy-1207110587")
1256    *           .setPageToken("pageToken873572522")
1257    *           .setProject("project-309310695")
1258    *           .setReturnPartialSuccess(true)
1259    *           .build();
1260    *   while (true) {
1261    *     BackendServiceList response = backendServicesClient.listCallable().call(request);
1262    *     for (BackendService element : response.getItemsList()) {
1263    *       // doThingsWith(element);
1264    *     }
1265    *     String nextPageToken = response.getNextPageToken();
1266    *     if (!Strings.isNullOrEmpty(nextPageToken)) {
1267    *       request = request.toBuilder().setPageToken(nextPageToken).build();
1268    *     } else {
1269    *       break;
1270    *     }
1271    *   }
1272    * }
1273    * }</pre>
1274    */
listCallable()1275   public final UnaryCallable<ListBackendServicesRequest, BackendServiceList> listCallable() {
1276     return stub.listCallable();
1277   }
1278 
1279   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1280   /**
1281    * Patches the specified BackendService resource with the data included in the request. For more
1282    * information, see Backend services overview. This method supports PATCH semantics and uses the
1283    * JSON merge patch format and processing rules.
1284    *
1285    * <p>Sample code:
1286    *
1287    * <pre>{@code
1288    * // This snippet has been automatically generated and should be regarded as a code template only.
1289    * // It will require modifications to work:
1290    * // - It may require correct/in-range values for request initialization.
1291    * // - It may require specifying regional endpoints when creating the service client as shown in
1292    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1293    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1294    *   String project = "project-309310695";
1295    *   String backendService = "backendService-1884714623";
1296    *   BackendService backendServiceResource = BackendService.newBuilder().build();
1297    *   Operation response =
1298    *       backendServicesClient.patchAsync(project, backendService, backendServiceResource).get();
1299    * }
1300    * }</pre>
1301    *
1302    * @param project Project ID for this request.
1303    * @param backendService Name of the BackendService resource to patch.
1304    * @param backendServiceResource The body resource for this request
1305    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1306    */
patchAsync( String project, String backendService, BackendService backendServiceResource)1307   public final OperationFuture<Operation, Operation> patchAsync(
1308       String project, String backendService, BackendService backendServiceResource) {
1309     PatchBackendServiceRequest request =
1310         PatchBackendServiceRequest.newBuilder()
1311             .setProject(project)
1312             .setBackendService(backendService)
1313             .setBackendServiceResource(backendServiceResource)
1314             .build();
1315     return patchAsync(request);
1316   }
1317 
1318   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1319   /**
1320    * Patches the specified BackendService resource with the data included in the request. For more
1321    * information, see Backend services overview. This method supports PATCH semantics and uses the
1322    * JSON merge patch format and processing rules.
1323    *
1324    * <p>Sample code:
1325    *
1326    * <pre>{@code
1327    * // This snippet has been automatically generated and should be regarded as a code template only.
1328    * // It will require modifications to work:
1329    * // - It may require correct/in-range values for request initialization.
1330    * // - It may require specifying regional endpoints when creating the service client as shown in
1331    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1332    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1333    *   PatchBackendServiceRequest request =
1334    *       PatchBackendServiceRequest.newBuilder()
1335    *           .setBackendService("backendService-1884714623")
1336    *           .setBackendServiceResource(BackendService.newBuilder().build())
1337    *           .setProject("project-309310695")
1338    *           .setRequestId("requestId693933066")
1339    *           .build();
1340    *   Operation response = backendServicesClient.patchAsync(request).get();
1341    * }
1342    * }</pre>
1343    *
1344    * @param request The request object containing all of the parameters for the API call.
1345    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1346    */
1347   @BetaApi(
1348       "The surface for long-running operations is not stable yet and may change in the future.")
patchAsync( PatchBackendServiceRequest request)1349   public final OperationFuture<Operation, Operation> patchAsync(
1350       PatchBackendServiceRequest request) {
1351     return patchOperationCallable().futureCall(request);
1352   }
1353 
1354   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1355   /**
1356    * Patches the specified BackendService resource with the data included in the request. For more
1357    * information, see Backend services overview. This method supports PATCH semantics and uses the
1358    * JSON merge patch format and processing rules.
1359    *
1360    * <p>Sample code:
1361    *
1362    * <pre>{@code
1363    * // This snippet has been automatically generated and should be regarded as a code template only.
1364    * // It will require modifications to work:
1365    * // - It may require correct/in-range values for request initialization.
1366    * // - It may require specifying regional endpoints when creating the service client as shown in
1367    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1368    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1369    *   PatchBackendServiceRequest request =
1370    *       PatchBackendServiceRequest.newBuilder()
1371    *           .setBackendService("backendService-1884714623")
1372    *           .setBackendServiceResource(BackendService.newBuilder().build())
1373    *           .setProject("project-309310695")
1374    *           .setRequestId("requestId693933066")
1375    *           .build();
1376    *   OperationFuture<Operation, Operation> future =
1377    *       backendServicesClient.patchOperationCallable().futureCall(request);
1378    *   // Do something.
1379    *   Operation response = future.get();
1380    * }
1381    * }</pre>
1382    */
1383   public final OperationCallable<PatchBackendServiceRequest, Operation, Operation>
patchOperationCallable()1384       patchOperationCallable() {
1385     return stub.patchOperationCallable();
1386   }
1387 
1388   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1389   /**
1390    * Patches the specified BackendService resource with the data included in the request. For more
1391    * information, see Backend services overview. This method supports PATCH semantics and uses the
1392    * JSON merge patch format and processing rules.
1393    *
1394    * <p>Sample code:
1395    *
1396    * <pre>{@code
1397    * // This snippet has been automatically generated and should be regarded as a code template only.
1398    * // It will require modifications to work:
1399    * // - It may require correct/in-range values for request initialization.
1400    * // - It may require specifying regional endpoints when creating the service client as shown in
1401    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1402    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1403    *   PatchBackendServiceRequest request =
1404    *       PatchBackendServiceRequest.newBuilder()
1405    *           .setBackendService("backendService-1884714623")
1406    *           .setBackendServiceResource(BackendService.newBuilder().build())
1407    *           .setProject("project-309310695")
1408    *           .setRequestId("requestId693933066")
1409    *           .build();
1410    *   ApiFuture<Operation> future = backendServicesClient.patchCallable().futureCall(request);
1411    *   // Do something.
1412    *   Operation response = future.get();
1413    * }
1414    * }</pre>
1415    */
patchCallable()1416   public final UnaryCallable<PatchBackendServiceRequest, Operation> patchCallable() {
1417     return stub.patchCallable();
1418   }
1419 
1420   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1421   /**
1422    * Sets the edge security policy for the specified backend service.
1423    *
1424    * <p>Sample code:
1425    *
1426    * <pre>{@code
1427    * // This snippet has been automatically generated and should be regarded as a code template only.
1428    * // It will require modifications to work:
1429    * // - It may require correct/in-range values for request initialization.
1430    * // - It may require specifying regional endpoints when creating the service client as shown in
1431    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1432    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1433    *   String project = "project-309310695";
1434    *   String backendService = "backendService-1884714623";
1435    *   SecurityPolicyReference securityPolicyReferenceResource =
1436    *       SecurityPolicyReference.newBuilder().build();
1437    *   Operation response =
1438    *       backendServicesClient
1439    *           .setEdgeSecurityPolicyAsync(project, backendService, securityPolicyReferenceResource)
1440    *           .get();
1441    * }
1442    * }</pre>
1443    *
1444    * @param project Project ID for this request.
1445    * @param backendService Name of the BackendService resource to which the edge security policy
1446    *     should be set. The name should conform to RFC1035.
1447    * @param securityPolicyReferenceResource The body resource for this request
1448    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1449    */
setEdgeSecurityPolicyAsync( String project, String backendService, SecurityPolicyReference securityPolicyReferenceResource)1450   public final OperationFuture<Operation, Operation> setEdgeSecurityPolicyAsync(
1451       String project,
1452       String backendService,
1453       SecurityPolicyReference securityPolicyReferenceResource) {
1454     SetEdgeSecurityPolicyBackendServiceRequest request =
1455         SetEdgeSecurityPolicyBackendServiceRequest.newBuilder()
1456             .setProject(project)
1457             .setBackendService(backendService)
1458             .setSecurityPolicyReferenceResource(securityPolicyReferenceResource)
1459             .build();
1460     return setEdgeSecurityPolicyAsync(request);
1461   }
1462 
1463   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1464   /**
1465    * Sets the edge security policy for the specified backend service.
1466    *
1467    * <p>Sample code:
1468    *
1469    * <pre>{@code
1470    * // This snippet has been automatically generated and should be regarded as a code template only.
1471    * // It will require modifications to work:
1472    * // - It may require correct/in-range values for request initialization.
1473    * // - It may require specifying regional endpoints when creating the service client as shown in
1474    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1475    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1476    *   SetEdgeSecurityPolicyBackendServiceRequest request =
1477    *       SetEdgeSecurityPolicyBackendServiceRequest.newBuilder()
1478    *           .setBackendService("backendService-1884714623")
1479    *           .setProject("project-309310695")
1480    *           .setRequestId("requestId693933066")
1481    *           .setSecurityPolicyReferenceResource(SecurityPolicyReference.newBuilder().build())
1482    *           .build();
1483    *   Operation response = backendServicesClient.setEdgeSecurityPolicyAsync(request).get();
1484    * }
1485    * }</pre>
1486    *
1487    * @param request The request object containing all of the parameters for the API call.
1488    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1489    */
1490   @BetaApi(
1491       "The surface for long-running operations is not stable yet and may change in the future.")
setEdgeSecurityPolicyAsync( SetEdgeSecurityPolicyBackendServiceRequest request)1492   public final OperationFuture<Operation, Operation> setEdgeSecurityPolicyAsync(
1493       SetEdgeSecurityPolicyBackendServiceRequest request) {
1494     return setEdgeSecurityPolicyOperationCallable().futureCall(request);
1495   }
1496 
1497   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1498   /**
1499    * Sets the edge security policy for the specified backend service.
1500    *
1501    * <p>Sample code:
1502    *
1503    * <pre>{@code
1504    * // This snippet has been automatically generated and should be regarded as a code template only.
1505    * // It will require modifications to work:
1506    * // - It may require correct/in-range values for request initialization.
1507    * // - It may require specifying regional endpoints when creating the service client as shown in
1508    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1509    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1510    *   SetEdgeSecurityPolicyBackendServiceRequest request =
1511    *       SetEdgeSecurityPolicyBackendServiceRequest.newBuilder()
1512    *           .setBackendService("backendService-1884714623")
1513    *           .setProject("project-309310695")
1514    *           .setRequestId("requestId693933066")
1515    *           .setSecurityPolicyReferenceResource(SecurityPolicyReference.newBuilder().build())
1516    *           .build();
1517    *   OperationFuture<Operation, Operation> future =
1518    *       backendServicesClient.setEdgeSecurityPolicyOperationCallable().futureCall(request);
1519    *   // Do something.
1520    *   Operation response = future.get();
1521    * }
1522    * }</pre>
1523    */
1524   public final OperationCallable<SetEdgeSecurityPolicyBackendServiceRequest, Operation, Operation>
setEdgeSecurityPolicyOperationCallable()1525       setEdgeSecurityPolicyOperationCallable() {
1526     return stub.setEdgeSecurityPolicyOperationCallable();
1527   }
1528 
1529   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1530   /**
1531    * Sets the edge security policy for the specified backend service.
1532    *
1533    * <p>Sample code:
1534    *
1535    * <pre>{@code
1536    * // This snippet has been automatically generated and should be regarded as a code template only.
1537    * // It will require modifications to work:
1538    * // - It may require correct/in-range values for request initialization.
1539    * // - It may require specifying regional endpoints when creating the service client as shown in
1540    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1541    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1542    *   SetEdgeSecurityPolicyBackendServiceRequest request =
1543    *       SetEdgeSecurityPolicyBackendServiceRequest.newBuilder()
1544    *           .setBackendService("backendService-1884714623")
1545    *           .setProject("project-309310695")
1546    *           .setRequestId("requestId693933066")
1547    *           .setSecurityPolicyReferenceResource(SecurityPolicyReference.newBuilder().build())
1548    *           .build();
1549    *   ApiFuture<Operation> future =
1550    *       backendServicesClient.setEdgeSecurityPolicyCallable().futureCall(request);
1551    *   // Do something.
1552    *   Operation response = future.get();
1553    * }
1554    * }</pre>
1555    */
1556   public final UnaryCallable<SetEdgeSecurityPolicyBackendServiceRequest, Operation>
setEdgeSecurityPolicyCallable()1557       setEdgeSecurityPolicyCallable() {
1558     return stub.setEdgeSecurityPolicyCallable();
1559   }
1560 
1561   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1562   /**
1563    * Sets the access control policy on the specified resource. Replaces any existing policy.
1564    *
1565    * <p>Sample code:
1566    *
1567    * <pre>{@code
1568    * // This snippet has been automatically generated and should be regarded as a code template only.
1569    * // It will require modifications to work:
1570    * // - It may require correct/in-range values for request initialization.
1571    * // - It may require specifying regional endpoints when creating the service client as shown in
1572    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1573    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1574    *   String project = "project-309310695";
1575    *   String resource = "resource-341064690";
1576    *   GlobalSetPolicyRequest globalSetPolicyRequestResource =
1577    *       GlobalSetPolicyRequest.newBuilder().build();
1578    *   Policy response =
1579    *       backendServicesClient.setIamPolicy(project, resource, globalSetPolicyRequestResource);
1580    * }
1581    * }</pre>
1582    *
1583    * @param project Project ID for this request.
1584    * @param resource Name or id of the resource for this request.
1585    * @param globalSetPolicyRequestResource The body resource for this request
1586    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1587    */
setIamPolicy( String project, String resource, GlobalSetPolicyRequest globalSetPolicyRequestResource)1588   public final Policy setIamPolicy(
1589       String project, String resource, GlobalSetPolicyRequest globalSetPolicyRequestResource) {
1590     SetIamPolicyBackendServiceRequest request =
1591         SetIamPolicyBackendServiceRequest.newBuilder()
1592             .setProject(project)
1593             .setResource(resource)
1594             .setGlobalSetPolicyRequestResource(globalSetPolicyRequestResource)
1595             .build();
1596     return setIamPolicy(request);
1597   }
1598 
1599   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1600   /**
1601    * Sets the access control policy on the specified resource. Replaces any existing policy.
1602    *
1603    * <p>Sample code:
1604    *
1605    * <pre>{@code
1606    * // This snippet has been automatically generated and should be regarded as a code template only.
1607    * // It will require modifications to work:
1608    * // - It may require correct/in-range values for request initialization.
1609    * // - It may require specifying regional endpoints when creating the service client as shown in
1610    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1611    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1612    *   SetIamPolicyBackendServiceRequest request =
1613    *       SetIamPolicyBackendServiceRequest.newBuilder()
1614    *           .setGlobalSetPolicyRequestResource(GlobalSetPolicyRequest.newBuilder().build())
1615    *           .setProject("project-309310695")
1616    *           .setResource("resource-341064690")
1617    *           .build();
1618    *   Policy response = backendServicesClient.setIamPolicy(request);
1619    * }
1620    * }</pre>
1621    *
1622    * @param request The request object containing all of the parameters for the API call.
1623    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1624    */
setIamPolicy(SetIamPolicyBackendServiceRequest request)1625   public final Policy setIamPolicy(SetIamPolicyBackendServiceRequest request) {
1626     return setIamPolicyCallable().call(request);
1627   }
1628 
1629   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1630   /**
1631    * Sets the access control policy on the specified resource. Replaces any existing policy.
1632    *
1633    * <p>Sample code:
1634    *
1635    * <pre>{@code
1636    * // This snippet has been automatically generated and should be regarded as a code template only.
1637    * // It will require modifications to work:
1638    * // - It may require correct/in-range values for request initialization.
1639    * // - It may require specifying regional endpoints when creating the service client as shown in
1640    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1641    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1642    *   SetIamPolicyBackendServiceRequest request =
1643    *       SetIamPolicyBackendServiceRequest.newBuilder()
1644    *           .setGlobalSetPolicyRequestResource(GlobalSetPolicyRequest.newBuilder().build())
1645    *           .setProject("project-309310695")
1646    *           .setResource("resource-341064690")
1647    *           .build();
1648    *   ApiFuture<Policy> future = backendServicesClient.setIamPolicyCallable().futureCall(request);
1649    *   // Do something.
1650    *   Policy response = future.get();
1651    * }
1652    * }</pre>
1653    */
setIamPolicyCallable()1654   public final UnaryCallable<SetIamPolicyBackendServiceRequest, Policy> setIamPolicyCallable() {
1655     return stub.setIamPolicyCallable();
1656   }
1657 
1658   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1659   /**
1660    * Sets the Google Cloud Armor security policy for the specified backend service. For more
1661    * information, see Google Cloud Armor Overview
1662    *
1663    * <p>Sample code:
1664    *
1665    * <pre>{@code
1666    * // This snippet has been automatically generated and should be regarded as a code template only.
1667    * // It will require modifications to work:
1668    * // - It may require correct/in-range values for request initialization.
1669    * // - It may require specifying regional endpoints when creating the service client as shown in
1670    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1671    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1672    *   String project = "project-309310695";
1673    *   String backendService = "backendService-1884714623";
1674    *   SecurityPolicyReference securityPolicyReferenceResource =
1675    *       SecurityPolicyReference.newBuilder().build();
1676    *   Operation response =
1677    *       backendServicesClient
1678    *           .setSecurityPolicyAsync(project, backendService, securityPolicyReferenceResource)
1679    *           .get();
1680    * }
1681    * }</pre>
1682    *
1683    * @param project Project ID for this request.
1684    * @param backendService Name of the BackendService resource to which the security policy should
1685    *     be set. The name should conform to RFC1035.
1686    * @param securityPolicyReferenceResource The body resource for this request
1687    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1688    */
setSecurityPolicyAsync( String project, String backendService, SecurityPolicyReference securityPolicyReferenceResource)1689   public final OperationFuture<Operation, Operation> setSecurityPolicyAsync(
1690       String project,
1691       String backendService,
1692       SecurityPolicyReference securityPolicyReferenceResource) {
1693     SetSecurityPolicyBackendServiceRequest request =
1694         SetSecurityPolicyBackendServiceRequest.newBuilder()
1695             .setProject(project)
1696             .setBackendService(backendService)
1697             .setSecurityPolicyReferenceResource(securityPolicyReferenceResource)
1698             .build();
1699     return setSecurityPolicyAsync(request);
1700   }
1701 
1702   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1703   /**
1704    * Sets the Google Cloud Armor security policy for the specified backend service. For more
1705    * information, see Google Cloud Armor Overview
1706    *
1707    * <p>Sample code:
1708    *
1709    * <pre>{@code
1710    * // This snippet has been automatically generated and should be regarded as a code template only.
1711    * // It will require modifications to work:
1712    * // - It may require correct/in-range values for request initialization.
1713    * // - It may require specifying regional endpoints when creating the service client as shown in
1714    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1715    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1716    *   SetSecurityPolicyBackendServiceRequest request =
1717    *       SetSecurityPolicyBackendServiceRequest.newBuilder()
1718    *           .setBackendService("backendService-1884714623")
1719    *           .setProject("project-309310695")
1720    *           .setRequestId("requestId693933066")
1721    *           .setSecurityPolicyReferenceResource(SecurityPolicyReference.newBuilder().build())
1722    *           .build();
1723    *   Operation response = backendServicesClient.setSecurityPolicyAsync(request).get();
1724    * }
1725    * }</pre>
1726    *
1727    * @param request The request object containing all of the parameters for the API call.
1728    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1729    */
1730   @BetaApi(
1731       "The surface for long-running operations is not stable yet and may change in the future.")
setSecurityPolicyAsync( SetSecurityPolicyBackendServiceRequest request)1732   public final OperationFuture<Operation, Operation> setSecurityPolicyAsync(
1733       SetSecurityPolicyBackendServiceRequest request) {
1734     return setSecurityPolicyOperationCallable().futureCall(request);
1735   }
1736 
1737   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1738   /**
1739    * Sets the Google Cloud Armor security policy for the specified backend service. For more
1740    * information, see Google Cloud Armor Overview
1741    *
1742    * <p>Sample code:
1743    *
1744    * <pre>{@code
1745    * // This snippet has been automatically generated and should be regarded as a code template only.
1746    * // It will require modifications to work:
1747    * // - It may require correct/in-range values for request initialization.
1748    * // - It may require specifying regional endpoints when creating the service client as shown in
1749    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1750    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1751    *   SetSecurityPolicyBackendServiceRequest request =
1752    *       SetSecurityPolicyBackendServiceRequest.newBuilder()
1753    *           .setBackendService("backendService-1884714623")
1754    *           .setProject("project-309310695")
1755    *           .setRequestId("requestId693933066")
1756    *           .setSecurityPolicyReferenceResource(SecurityPolicyReference.newBuilder().build())
1757    *           .build();
1758    *   OperationFuture<Operation, Operation> future =
1759    *       backendServicesClient.setSecurityPolicyOperationCallable().futureCall(request);
1760    *   // Do something.
1761    *   Operation response = future.get();
1762    * }
1763    * }</pre>
1764    */
1765   public final OperationCallable<SetSecurityPolicyBackendServiceRequest, Operation, Operation>
setSecurityPolicyOperationCallable()1766       setSecurityPolicyOperationCallable() {
1767     return stub.setSecurityPolicyOperationCallable();
1768   }
1769 
1770   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1771   /**
1772    * Sets the Google Cloud Armor security policy for the specified backend service. For more
1773    * information, see Google Cloud Armor Overview
1774    *
1775    * <p>Sample code:
1776    *
1777    * <pre>{@code
1778    * // This snippet has been automatically generated and should be regarded as a code template only.
1779    * // It will require modifications to work:
1780    * // - It may require correct/in-range values for request initialization.
1781    * // - It may require specifying regional endpoints when creating the service client as shown in
1782    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1783    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1784    *   SetSecurityPolicyBackendServiceRequest request =
1785    *       SetSecurityPolicyBackendServiceRequest.newBuilder()
1786    *           .setBackendService("backendService-1884714623")
1787    *           .setProject("project-309310695")
1788    *           .setRequestId("requestId693933066")
1789    *           .setSecurityPolicyReferenceResource(SecurityPolicyReference.newBuilder().build())
1790    *           .build();
1791    *   ApiFuture<Operation> future =
1792    *       backendServicesClient.setSecurityPolicyCallable().futureCall(request);
1793    *   // Do something.
1794    *   Operation response = future.get();
1795    * }
1796    * }</pre>
1797    */
1798   public final UnaryCallable<SetSecurityPolicyBackendServiceRequest, Operation>
setSecurityPolicyCallable()1799       setSecurityPolicyCallable() {
1800     return stub.setSecurityPolicyCallable();
1801   }
1802 
1803   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1804   /**
1805    * Updates the specified BackendService resource with the data included in the request. For more
1806    * information, see Backend services overview.
1807    *
1808    * <p>Sample code:
1809    *
1810    * <pre>{@code
1811    * // This snippet has been automatically generated and should be regarded as a code template only.
1812    * // It will require modifications to work:
1813    * // - It may require correct/in-range values for request initialization.
1814    * // - It may require specifying regional endpoints when creating the service client as shown in
1815    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1816    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1817    *   String project = "project-309310695";
1818    *   String backendService = "backendService-1884714623";
1819    *   BackendService backendServiceResource = BackendService.newBuilder().build();
1820    *   Operation response =
1821    *       backendServicesClient.updateAsync(project, backendService, backendServiceResource).get();
1822    * }
1823    * }</pre>
1824    *
1825    * @param project Project ID for this request.
1826    * @param backendService Name of the BackendService resource to update.
1827    * @param backendServiceResource The body resource for this request
1828    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1829    */
updateAsync( String project, String backendService, BackendService backendServiceResource)1830   public final OperationFuture<Operation, Operation> updateAsync(
1831       String project, String backendService, BackendService backendServiceResource) {
1832     UpdateBackendServiceRequest request =
1833         UpdateBackendServiceRequest.newBuilder()
1834             .setProject(project)
1835             .setBackendService(backendService)
1836             .setBackendServiceResource(backendServiceResource)
1837             .build();
1838     return updateAsync(request);
1839   }
1840 
1841   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1842   /**
1843    * Updates the specified BackendService resource with the data included in the request. For more
1844    * information, see Backend services overview.
1845    *
1846    * <p>Sample code:
1847    *
1848    * <pre>{@code
1849    * // This snippet has been automatically generated and should be regarded as a code template only.
1850    * // It will require modifications to work:
1851    * // - It may require correct/in-range values for request initialization.
1852    * // - It may require specifying regional endpoints when creating the service client as shown in
1853    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1854    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1855    *   UpdateBackendServiceRequest request =
1856    *       UpdateBackendServiceRequest.newBuilder()
1857    *           .setBackendService("backendService-1884714623")
1858    *           .setBackendServiceResource(BackendService.newBuilder().build())
1859    *           .setProject("project-309310695")
1860    *           .setRequestId("requestId693933066")
1861    *           .build();
1862    *   Operation response = backendServicesClient.updateAsync(request).get();
1863    * }
1864    * }</pre>
1865    *
1866    * @param request The request object containing all of the parameters for the API call.
1867    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1868    */
1869   @BetaApi(
1870       "The surface for long-running operations is not stable yet and may change in the future.")
updateAsync( UpdateBackendServiceRequest request)1871   public final OperationFuture<Operation, Operation> updateAsync(
1872       UpdateBackendServiceRequest request) {
1873     return updateOperationCallable().futureCall(request);
1874   }
1875 
1876   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1877   /**
1878    * Updates the specified BackendService resource with the data included in the request. For more
1879    * information, see Backend services overview.
1880    *
1881    * <p>Sample code:
1882    *
1883    * <pre>{@code
1884    * // This snippet has been automatically generated and should be regarded as a code template only.
1885    * // It will require modifications to work:
1886    * // - It may require correct/in-range values for request initialization.
1887    * // - It may require specifying regional endpoints when creating the service client as shown in
1888    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1889    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1890    *   UpdateBackendServiceRequest request =
1891    *       UpdateBackendServiceRequest.newBuilder()
1892    *           .setBackendService("backendService-1884714623")
1893    *           .setBackendServiceResource(BackendService.newBuilder().build())
1894    *           .setProject("project-309310695")
1895    *           .setRequestId("requestId693933066")
1896    *           .build();
1897    *   OperationFuture<Operation, Operation> future =
1898    *       backendServicesClient.updateOperationCallable().futureCall(request);
1899    *   // Do something.
1900    *   Operation response = future.get();
1901    * }
1902    * }</pre>
1903    */
1904   public final OperationCallable<UpdateBackendServiceRequest, Operation, Operation>
updateOperationCallable()1905       updateOperationCallable() {
1906     return stub.updateOperationCallable();
1907   }
1908 
1909   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1910   /**
1911    * Updates the specified BackendService resource with the data included in the request. For more
1912    * information, see Backend services overview.
1913    *
1914    * <p>Sample code:
1915    *
1916    * <pre>{@code
1917    * // This snippet has been automatically generated and should be regarded as a code template only.
1918    * // It will require modifications to work:
1919    * // - It may require correct/in-range values for request initialization.
1920    * // - It may require specifying regional endpoints when creating the service client as shown in
1921    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1922    * try (BackendServicesClient backendServicesClient = BackendServicesClient.create()) {
1923    *   UpdateBackendServiceRequest request =
1924    *       UpdateBackendServiceRequest.newBuilder()
1925    *           .setBackendService("backendService-1884714623")
1926    *           .setBackendServiceResource(BackendService.newBuilder().build())
1927    *           .setProject("project-309310695")
1928    *           .setRequestId("requestId693933066")
1929    *           .build();
1930    *   ApiFuture<Operation> future = backendServicesClient.updateCallable().futureCall(request);
1931    *   // Do something.
1932    *   Operation response = future.get();
1933    * }
1934    * }</pre>
1935    */
updateCallable()1936   public final UnaryCallable<UpdateBackendServiceRequest, Operation> updateCallable() {
1937     return stub.updateCallable();
1938   }
1939 
1940   @Override
close()1941   public final void close() {
1942     stub.close();
1943   }
1944 
1945   @Override
shutdown()1946   public void shutdown() {
1947     stub.shutdown();
1948   }
1949 
1950   @Override
isShutdown()1951   public boolean isShutdown() {
1952     return stub.isShutdown();
1953   }
1954 
1955   @Override
isTerminated()1956   public boolean isTerminated() {
1957     return stub.isTerminated();
1958   }
1959 
1960   @Override
shutdownNow()1961   public void shutdownNow() {
1962     stub.shutdownNow();
1963   }
1964 
1965   @Override
awaitTermination(long duration, TimeUnit unit)1966   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
1967     return stub.awaitTermination(duration, unit);
1968   }
1969 
1970   public static class AggregatedListPagedResponse
1971       extends AbstractPagedListResponse<
1972           AggregatedListBackendServicesRequest,
1973           BackendServiceAggregatedList,
1974           Map.Entry<String, BackendServicesScopedList>,
1975           AggregatedListPage,
1976           AggregatedListFixedSizeCollection> {
1977 
createAsync( PageContext< AggregatedListBackendServicesRequest, BackendServiceAggregatedList, Map.Entry<String, BackendServicesScopedList>> context, ApiFuture<BackendServiceAggregatedList> futureResponse)1978     public static ApiFuture<AggregatedListPagedResponse> createAsync(
1979         PageContext<
1980                 AggregatedListBackendServicesRequest,
1981                 BackendServiceAggregatedList,
1982                 Map.Entry<String, BackendServicesScopedList>>
1983             context,
1984         ApiFuture<BackendServiceAggregatedList> futureResponse) {
1985       ApiFuture<AggregatedListPage> futurePage =
1986           AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse);
1987       return ApiFutures.transform(
1988           futurePage,
1989           input -> new AggregatedListPagedResponse(input),
1990           MoreExecutors.directExecutor());
1991     }
1992 
AggregatedListPagedResponse(AggregatedListPage page)1993     private AggregatedListPagedResponse(AggregatedListPage page) {
1994       super(page, AggregatedListFixedSizeCollection.createEmptyCollection());
1995     }
1996   }
1997 
1998   public static class AggregatedListPage
1999       extends AbstractPage<
2000           AggregatedListBackendServicesRequest,
2001           BackendServiceAggregatedList,
2002           Map.Entry<String, BackendServicesScopedList>,
2003           AggregatedListPage> {
2004 
AggregatedListPage( PageContext< AggregatedListBackendServicesRequest, BackendServiceAggregatedList, Map.Entry<String, BackendServicesScopedList>> context, BackendServiceAggregatedList response)2005     private AggregatedListPage(
2006         PageContext<
2007                 AggregatedListBackendServicesRequest,
2008                 BackendServiceAggregatedList,
2009                 Map.Entry<String, BackendServicesScopedList>>
2010             context,
2011         BackendServiceAggregatedList response) {
2012       super(context, response);
2013     }
2014 
createEmptyPage()2015     private static AggregatedListPage createEmptyPage() {
2016       return new AggregatedListPage(null, null);
2017     }
2018 
2019     @Override
createPage( PageContext< AggregatedListBackendServicesRequest, BackendServiceAggregatedList, Map.Entry<String, BackendServicesScopedList>> context, BackendServiceAggregatedList response)2020     protected AggregatedListPage createPage(
2021         PageContext<
2022                 AggregatedListBackendServicesRequest,
2023                 BackendServiceAggregatedList,
2024                 Map.Entry<String, BackendServicesScopedList>>
2025             context,
2026         BackendServiceAggregatedList response) {
2027       return new AggregatedListPage(context, response);
2028     }
2029 
2030     @Override
createPageAsync( PageContext< AggregatedListBackendServicesRequest, BackendServiceAggregatedList, Map.Entry<String, BackendServicesScopedList>> context, ApiFuture<BackendServiceAggregatedList> futureResponse)2031     public ApiFuture<AggregatedListPage> createPageAsync(
2032         PageContext<
2033                 AggregatedListBackendServicesRequest,
2034                 BackendServiceAggregatedList,
2035                 Map.Entry<String, BackendServicesScopedList>>
2036             context,
2037         ApiFuture<BackendServiceAggregatedList> futureResponse) {
2038       return super.createPageAsync(context, futureResponse);
2039     }
2040   }
2041 
2042   public static class AggregatedListFixedSizeCollection
2043       extends AbstractFixedSizeCollection<
2044           AggregatedListBackendServicesRequest,
2045           BackendServiceAggregatedList,
2046           Map.Entry<String, BackendServicesScopedList>,
2047           AggregatedListPage,
2048           AggregatedListFixedSizeCollection> {
2049 
AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize)2050     private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) {
2051       super(pages, collectionSize);
2052     }
2053 
createEmptyCollection()2054     private static AggregatedListFixedSizeCollection createEmptyCollection() {
2055       return new AggregatedListFixedSizeCollection(null, 0);
2056     }
2057 
2058     @Override
createCollection( List<AggregatedListPage> pages, int collectionSize)2059     protected AggregatedListFixedSizeCollection createCollection(
2060         List<AggregatedListPage> pages, int collectionSize) {
2061       return new AggregatedListFixedSizeCollection(pages, collectionSize);
2062     }
2063   }
2064 
2065   public static class ListPagedResponse
2066       extends AbstractPagedListResponse<
2067           ListBackendServicesRequest,
2068           BackendServiceList,
2069           BackendService,
2070           ListPage,
2071           ListFixedSizeCollection> {
2072 
createAsync( PageContext<ListBackendServicesRequest, BackendServiceList, BackendService> context, ApiFuture<BackendServiceList> futureResponse)2073     public static ApiFuture<ListPagedResponse> createAsync(
2074         PageContext<ListBackendServicesRequest, BackendServiceList, BackendService> context,
2075         ApiFuture<BackendServiceList> futureResponse) {
2076       ApiFuture<ListPage> futurePage =
2077           ListPage.createEmptyPage().createPageAsync(context, futureResponse);
2078       return ApiFutures.transform(
2079           futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor());
2080     }
2081 
ListPagedResponse(ListPage page)2082     private ListPagedResponse(ListPage page) {
2083       super(page, ListFixedSizeCollection.createEmptyCollection());
2084     }
2085   }
2086 
2087   public static class ListPage
2088       extends AbstractPage<
2089           ListBackendServicesRequest, BackendServiceList, BackendService, ListPage> {
2090 
ListPage( PageContext<ListBackendServicesRequest, BackendServiceList, BackendService> context, BackendServiceList response)2091     private ListPage(
2092         PageContext<ListBackendServicesRequest, BackendServiceList, BackendService> context,
2093         BackendServiceList response) {
2094       super(context, response);
2095     }
2096 
createEmptyPage()2097     private static ListPage createEmptyPage() {
2098       return new ListPage(null, null);
2099     }
2100 
2101     @Override
createPage( PageContext<ListBackendServicesRequest, BackendServiceList, BackendService> context, BackendServiceList response)2102     protected ListPage createPage(
2103         PageContext<ListBackendServicesRequest, BackendServiceList, BackendService> context,
2104         BackendServiceList response) {
2105       return new ListPage(context, response);
2106     }
2107 
2108     @Override
createPageAsync( PageContext<ListBackendServicesRequest, BackendServiceList, BackendService> context, ApiFuture<BackendServiceList> futureResponse)2109     public ApiFuture<ListPage> createPageAsync(
2110         PageContext<ListBackendServicesRequest, BackendServiceList, BackendService> context,
2111         ApiFuture<BackendServiceList> futureResponse) {
2112       return super.createPageAsync(context, futureResponse);
2113     }
2114   }
2115 
2116   public static class ListFixedSizeCollection
2117       extends AbstractFixedSizeCollection<
2118           ListBackendServicesRequest,
2119           BackendServiceList,
2120           BackendService,
2121           ListPage,
2122           ListFixedSizeCollection> {
2123 
ListFixedSizeCollection(List<ListPage> pages, int collectionSize)2124     private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) {
2125       super(pages, collectionSize);
2126     }
2127 
createEmptyCollection()2128     private static ListFixedSizeCollection createEmptyCollection() {
2129       return new ListFixedSizeCollection(null, 0);
2130     }
2131 
2132     @Override
createCollection(List<ListPage> pages, int collectionSize)2133     protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) {
2134       return new ListFixedSizeCollection(pages, collectionSize);
2135     }
2136   }
2137 }
2138